No description
Find a file
oldosfan 713eb811ea Add support for DRM leasing and significantly rework composition code
* 12to11.c (HandleCmdline): Improve messages printed during
-help.
(XLMain): Initialize DRM leasing.
* 12to11.man: Document changes.
* Imakefile (LOCAL_LIBRARIES): Add xcb-randr, xf86drm and
XPresent.
(SRCS): Add drm_lease.c.
(OBJS): Add drm_lease.o.
* atoms.c (names): Add CONNECTOR_ID.
(CONNECTOR_ID): New atom.
(XLInitAtoms): Intern CONNECTOR_ID.
* compositor.h (struct _RenderFuncs): Require event mask to be
passed to target_from_window.  New functions
`set_standard_event_mask', `present_to_window',
`cancel_presentation_callback', and `cancel_presentation'.
(struct _BufferFuncs): Move buffer release machinery here.
(enum _FrameMode): New enum.
* egl.c (TargetFromWindow, SetStandardEventMask,
egl_render_funcs): Adjust functions accordingly.
* frame_clock.c (struct _FrameClock): New fields
`end_frame_called' and `pending_sync_value'.
(HandleEndFrame, PostEndFrame, StartFrame, EndFrame): Clean up
frame synchronization code.  Do not end upon predicted
presentation time if EndFrame was not called in time.
(FreezeForValue): New function.
(XLFrameClockHandleFrameEvent): Defer actually freezing until
StartFrame happens.
(XLFrameClockGetFrameTime): New function.
* icon_surface.c (ReleaseBuffer): Use RenderWaitForIdle.
(RunFrameCallbacks, AfterFrame): Pass frame clock to callbacks.
Use frame time if available.
(XLGetIconSurface): Require wait_for_idle to work.
* output.c (change_hook): New hook.
(XLHandleOneXEventForOutputs): Run hook if set.
(XLOutputSetChangeFunction): New function.
(XLInitRROutputs): Select for RRResourceChangeNotify if
providers are supported.
* picture_renderer.c (struct _PresentRecord)
(struct _BufferActivityRecord, struct _IdleCallback)
(struct _PictureBuffer, struct _PictureTarget)
(struct _DrmFormatInfo, struct _DmaBufRecord)
(struct _PresentCompletionCallback): New record structures.
(all_formats, SendRoundtripMessage, FindBufferActivityRecord)
(RecordBufferActivity, RunIdleCallbacks, MaybeRunIdleCallbacks)
(UnlinkActivityRecord, HandleActivityEvent, InitRenderFuncs)
(TargetFromDrawable, TargetFromPixmap, TargetFromWindow)
(SetStandardEventMask, NoteTargetSize, PictureFromTarget)
(DestroyRenderTarget, FillBoxesWithTransparency)
(ServerRegionFromRegion, ClearRectangle, Composite)
(FindPresentRecord, AllocateRecord, PresentToWindow)
(CancelPresentationCallback, CancelPresentation)
(picture_render_funcs, FindSupportedModifiers, InitDrmFormats)
(PictFormatIsPresentable, BufferFromDmaBuf, FinishDmaBufRecord)
(BufferFromDmaBufAsync, BufferFromShm, BufferFromSinglePixel)
(FreeShmBuffer, FreeDmabufBuffer, FreeSinglePixelBuffer)
(AddIdleCallback, CancelIdleCallback, IsBufferIdle)
(IdleEventPredicate, WaitForIdle, SetNeedWaitForIdle)
(picture_buffer_funcs, HandlePresentCompleteNotify)
(HandlePresentIdleNotify, HandlePresentationEvent)
(HandleOneXEventForPictureRenderer, InitPictureRenderer): Allow
presenting pixmaps directly, and move buffer release tracking
machinery here.
* renderer.c (RenderTargetFromWindow): Update signature.
(RenderPresentToWindow, RenderCancelPresentationCallback)
(RenderCancelPresentation, RenderAddIdleCallback)
(RegisterStaticRenderer): New wrapper functions.
* run.c (HandleOneXEvent): Handle picture renderer events
earlier.
* seat.c (MaybeCreateCursor): Require wait_for_idle.
(ReleaseBuffer): Wait for buffer to become idle on each target
in the cursor ring.
* subcompositor.c (struct _Subcompositor): New callback
`note_frame'.
(SubcompositorSetNoteFrameCallback, NoViewsAfter)
(PresentCompletedCallback): New functions.
(SubcompositorUpdate): Try to present the buffer if possible,
and run completion callbacks.
(SubcompositorFree): Free presentation key.
* surface.c (XLSurfaceRunFrameCallbacksMs): New function.
* text_input.c: Improve commentary.
* xdg-shell.xml: Update from wayland-protocols.
* xdg_surface.c (struct _XdgRole): New fields `pending_frame',
`last_specified_serial'.
(struct _ReleaseLaterRecord): Replace free function with idle
callback key and xdg role pointers.
(RemoveRecord): Delete function.
(FreeRecords): Stop cancelling buffer destroy listener.
(ReleaseLaterExtBufferFunc): Delete function.
(RunFrameCallbacks): Use frame clock time if it is set.
(HandleReleaseLaterMessage): Delete function.
(BufferIdleCallback): New function.
(ReleaseLater): Delete function.
(XLHandleXEventForXdgSurfaces): Stop handling buffer release
events here.
(AckConfigure): Improve debug code and reject duplicate serials.
(Commit): Unfreeze earlier; also, in general...
(NoteFrame): Move frame handling implementation here.
(ReleaseBuffer, Subframe, EndSubframe, AfterFrame, ResizeForMap)
(SelectExtraEvents): Set standard event mask.
(XLGetXdgSurface, XLXdgRoleSendConfigure): ...Replace frame
clock logic with that in NoteFrame.
2022-10-12 12:53:09 +00:00
12to11.c Add support for DRM leasing and significantly rework composition code 2022-10-12 12:53:09 +00:00
12to11.conf Check in new file 2022-10-12 12:22:55 +00:00
12to11.man Add support for DRM leasing and significantly rework composition code 2022-10-12 12:53:09 +00:00
alloc.c Implement support for zwp_text_input_manager_v3 2022-10-06 02:09:36 +00:00
atoms.c Add support for DRM leasing and significantly rework composition code 2022-10-12 12:53:09 +00:00
buffer.c Add support for EGL, for YUV image formats 2022-09-23 08:44:37 +00:00
compositor.c Import files 2022-09-12 13:24:50 +00:00
compositor.h Add support for DRM leasing and significantly rework composition code 2022-10-12 12:53:09 +00:00
data_device.c Various improvements to primary selections and resize handling 2022-09-15 02:08:55 +00:00
decoration.c Check in files for XDG decoration support 2022-09-30 07:34:55 +00:00
dmabuf.c Fix subsurface visibility lifecycle 2022-09-30 03:13:11 +00:00
dnd.c Implement wp_viewporter support and fix scaling for fractional values 2022-09-30 01:17:47 +00:00
drm-lease-v1.xml Update files for DRM leasing 2022-10-12 12:22:39 +00:00
drm_lease.c Update files for DRM leasing 2022-10-12 12:22:39 +00:00
egl.c Add support for DRM leasing and significantly rework composition code 2022-10-12 12:53:09 +00:00
ewmh.c Import files 2022-09-12 13:24:50 +00:00
explicit_synchronization.c Minor fixes to EGL renderer and toplevel resizing 2022-10-01 02:50:58 +00:00
fns.c Implement wp_viewporter support and fix scaling for fractional values 2022-09-30 01:17:47 +00:00
frame_clock.c Add support for DRM leasing and significantly rework composition code 2022-10-12 12:53:09 +00:00
icon_surface.c Add support for DRM leasing and significantly rework composition code 2022-10-12 12:53:09 +00:00
Imakefile Add support for DRM leasing and significantly rework composition code 2022-10-12 12:53:09 +00:00
linux-dmabuf-unstable-v1.xml Import files 2022-09-12 13:24:50 +00:00
linux-explicit-synchronization-unstable-v1.xml Check in new files for explicit synchronization 2022-09-25 08:13:27 +00:00
media_types.txt Import files 2022-09-12 13:24:50 +00:00
mime0.awk Import files 2022-09-12 13:24:50 +00:00
mime1.awk Implement primary selections, and minor improvements elsewhere 2022-09-13 11:41:07 +00:00
mime2.awk Import files 2022-09-12 13:24:50 +00:00
mime3.awk Import files 2022-09-12 13:24:50 +00:00
mime4.awk Import files 2022-09-12 13:24:50 +00:00
output.c Add support for DRM leasing and significantly rework composition code 2022-10-12 12:53:09 +00:00
picture_renderer.c Add support for DRM leasing and significantly rework composition code 2022-10-12 12:53:09 +00:00
positioner.c Implement wp_viewporter support and fix scaling for fractional values 2022-09-30 01:17:47 +00:00
primary-selection-unstable-v1.xml Check in new files for primary selection support 2022-09-13 11:33:57 +00:00
primary_selection.c Various improvements to primary selections and resize handling 2022-09-15 02:08:55 +00:00
README Add support for more resources and single pixel buffers 2022-10-06 10:46:54 +00:00
region.c Import files 2022-09-12 13:24:50 +00:00
renderer.c Add support for DRM leasing and significantly rework composition code 2022-10-12 12:53:09 +00:00
run.c Add support for DRM leasing and significantly rework composition code 2022-10-12 12:53:09 +00:00
seat.c Add support for DRM leasing and significantly rework composition code 2022-10-12 12:53:09 +00:00
select.c Import files 2022-09-12 13:24:50 +00:00
shaders.awk Check in new files for EGL support 2022-09-23 08:28:48 +00:00
shaders.txt Add support for more resources and single pixel buffers 2022-10-06 10:46:54 +00:00
shm.c Fix subsurface visibility lifecycle 2022-09-30 03:13:11 +00:00
single-pixel-buffer-v1.xml Check in files for single pixel buffer support 2022-10-06 10:42:20 +00:00
single_pixel_buffer.c ; * single_pixel_buffer.c (CreateU32RgbaBuffer): Fix typo. 2022-10-06 10:47:13 +00:00
subcompositor.c Add support for DRM leasing and significantly rework composition code 2022-10-12 12:53:09 +00:00
subsurface.c Fix subsurface visibility lifecycle 2022-09-30 03:13:11 +00:00
surface.c Add support for DRM leasing and significantly rework composition code 2022-10-12 12:53:09 +00:00
text-input-unstable-v3.xml Check in files for text input support 2022-10-06 02:03:29 +00:00
text_input.c Add support for DRM leasing and significantly rework composition code 2022-10-12 12:53:09 +00:00
timer.c Import files 2022-09-12 13:24:50 +00:00
transform.c Add files for viewporter support 2022-09-30 01:00:09 +00:00
viewporter.xml Add files for viewporter support 2022-09-30 01:00:09 +00:00
wp_viewporter.c Add files for viewporter support 2022-09-30 01:00:09 +00:00
xdata.c Implement explicit synchronization 2022-09-25 08:21:31 +00:00
xdg-decoration-unstable-v1.xml Check in files for XDG decoration support 2022-09-30 07:34:55 +00:00
xdg-shell.xml Add support for DRM leasing and significantly rework composition code 2022-10-12 12:53:09 +00:00
xdg_popup.c Implement wp_viewporter support and fix scaling for fractional values 2022-09-30 01:17:47 +00:00
xdg_surface.c Add support for DRM leasing and significantly rework composition code 2022-10-12 12:53:09 +00:00
xdg_toplevel.c Minor fixes to input method handling 2022-10-07 02:08:41 +00:00
xdg_wm.c Import files 2022-09-12 13:24:50 +00:00
xerror.c Add support for EGL, for YUV image formats 2022-09-23 08:44:37 +00:00
xsettings.c Import files 2022-09-12 13:24:50 +00:00

This is a tool for running Wayland applications on an X server,
preferably with a compositing manager running.

It is not yet complete.  What is not yet implemented includes support
for touchscreens, input methods, device switching in dmabuf feedback,
and the single-pixel buffer protocol extension.

There are also problems with output reporting in subsurfaces.

It is not portable to systems other than recent versions of GNU/Linux
running the X.Org server 1.20 or later, and has not been tested on
window (and compositing) managers other than GNOME Shell.

It will not work very well unless the compositing manager supports the
EWMH frame synchronization protocol.

Building and running this tool requires the following X protocol
extensions:

  Nonrectangular Window Shape Extension, version 1.1 or later
  MIT Shared Memory Extension, version 1.2 or later
  X Resize, Rotate and Reflect Extension, version 1.3 or later
    (this will soon be 1.4, once support for multiple GPU
     systems is fully implemented)
  X Synchronization Extension, version 1.0 or later
  X Rendering Extension, version 1.2 or later
  X Input Extension, version 2.3 or later
  Direct Rendering Interface 3, version 1.2 or later
  X Fixes Extension, version 1 or later

In addition, it requires Xlib to be built with the XCB transport, and
the XCB bindings for MIT-SHM and DRI3 to be available.

Sometimes, it might be desirable to build with EGL, and use OpenGL ES
2.0 for i.e. YUV video format support.  To do so, uncomment the block
of code for EGL support in libraries.def before running `xmkmf'.  This
will additionally require the EGL and GLESv2 development files, and
for the following EGL and GLES extensions to be present at runtime:

  EGL_EXT_platform_base
  EGL_EXT_device_query
  EGL_KHR_image_base
  EGL_EXT_image_dma_buf_import_modifiers
  EGL_EXT_image_dma_buf_import
  EGL_EXT_buffer_age

  GL_OES_EGL_image
  GL_OES_EGL_image_external
  GL_EXT_read_format_bgra
  GL_EXT_unpack_subimage

After building with EGL support, the renderer must be enabled by
setting the environment variable "RENDERER" to "egl", or by setting
the "renderer" resource (class "Renderer") to "egl".

The following Wayland protocols are implemented to a more-or-less
complete degree:

  'wl_output',                                  version:  2
  'wl_compositor',                              version:  5
  'wl_shm',                                     version:  1
  'xdg_wm_base',                                version:  5
  'wl_subcompositor',                           version:  1
  'wl_seat',                                    version:  7
  'wl_data_device_manager',                     version:  3
  'zwp_linux_dmabuf_v1',                        version:  4
  'zwp_primary_selection_device_manager_v1',    version:  1
  'wp_viewporter',                              version:  1
  'zxdg_decoration_manager_v1',                 version:  1
  'zwp_text_input_manager_v3',                  version:  1
  'wp_single_pixel_buffer_manager_v1',          version:  1

When built with EGL, the following Wayland protocol is also supported:

  'zwp_linux_explicit_synchronization_v1',      version:  2

With the main caveat being that zwp_linux_dmabuf_v1 has no real
support for multiple-provider setups (help wanted).

Window decorations are also not supported, even though they fit in
nicely with X window management.

It would also be nice to have pinch gesture support.

This directory is organized as follows:

  Imakefile     - the top level Makefile template
  libraries.def - files for libraries that don't provide Imakefiles
  *.xml         - Wayland protocol definition source
  *.c, *.h      - C source code
  *.awk         - scripts used to generate headers
  *.txt         - text data used to generate some headers, i.e.
                  those containing MIME types or shaders

Building the source code is simple, provided that you have the
necessary libwayland-server library, pixman, XCB, and X extension
libraries installed:

  xmkmf # to generate the Makefile
  make  # to build the binary

wayland-scanner is also required when building from the repository.

Running the binary should be simple as well:

  ./12to11

Wayland programs will then run as regular X windows.