forked from 12to11/12to11

* 12to11.c (XLMain): Initialize wp_viewporter. * Imakefile (ETAGS): Remove unused variable. (SRCS, OBJS): Add wp_viewporter.c and wp_viewporter.o. (GENHEADERS): Remove unnecessary headers. (viewporter): New scanner target. * README: Document support for wp_viewporter. * compositor.h (struct _ViewportExt): New forward declaration. (struct _DrawParams): New fields for cropping and stretching. (struct _RenderFuncs): Describe how composite works. (struct _BufferFuncs): Make update_buffer_for_damage take DrawParams as an argument. (struct _State): New fields for viewporting. (struct _Surface): New field `viewport' and associated input delta. (struct _XdgRoleImplementationFuncs): New field `is_window_mapped'. Do not commit while unmapped. * dmabuf.c (XLInitDmabuf): Remove outdated comment. * dnd.c (HandleMotion): Use TruncateWindowToSurface. * egl.c (struct _EglBuffer): Add 3x3 reverse transformation matrix. (struct _CompositeProgram): Rename `scale' to `source'. (Index): New macro. (PickBetterVisual, FindVisual): Compensate for EGL picking a non-RGBA visual. (EglCompileCompositeProgram): Look for source, not scale. (ComputeTransformMatrix): New function. (Composite): Compute transformation matrix and draw using that. (BufferFromDmaBuf, BufferFromShm): Copy identity transform and stop setting scale. (ReverseTransformToBox): New function. (UpdateShmBufferIncrementally): Accept DrawParams and invert damage according to that. (UpdateBuffer, UpdateBufferForDamage): Pass draw params to the incremental buffer update function. * fns.c (XLExtendRegion): New function. * frame_clock.c (CurrentHighPrecisionTimestamp): Delete function. (HighPrecisionTimestamp, HighPrecisionTimestamp32): New functions. (PostEndFrame): Handle X server time truncation to 32 bits. (XLFrameClockFreeze): Remove trailing whitespace. * picture_renderer.c (GetSourceX, GetSourceY, CompareStretch): New functions. (MaybeApplyTransform): Check more values before applying transformations. Then, handle stretch and offset. * positioner.c (GetAdjustmentOffset, ApplyConstraintAdjustment) (XLPositionerCalculateGeometry): Scale coordinates using new functions. * renderer.c (RenderUpdateBufferForDamage): Accept DrawParams instead of scale. * shaders.txt (Composite Rectangle Fragment Shader RGBA) (Composite Rectangle Fragment Shader RGBX) (Composite Rectangle Fragment Shader External): Stop transforming texcoords. (Composite Rectangle Vertex Shader): Transform texcoords in the vertex shader instead. * subcompositor.c (IsViewported, SetViewported, ClearViewported): New functions. (struct _View): New fields for tracking viewports and fractional offsets. (ViewAttachBuffer): Do not garbage upon buffer size change if a viewport is set. (ViewMoveFractional): New function. (ViewDamage): Describe what the damage is and is not transformed by. (GetContentScale): New function. (ViewWidth, ViewHeight): Apply viewport. (ViewSetScale): Use ViewAfterSizeUpdate instead of duplicating code. (ViewSetViewport, ViewClearViewport): New functions. (ViewComputeTransform): Compute transform for viewports. New arg draw; use it to determine whether or not to include a fractional offset. (IntersectBoxes): Fix intersection calculation. (SubcompositorUpdate): Don't keep calling ViewWidth and ViewHeight in a loop. (SubcompositorExpose): Adjust for changes to buffer damage uploading. * subsurface.c (MoveFractional): New function. Handle fractional offsets after scaling. (MaybeUpdateOutputs, AfterParentCommit, Setup, Rescale): Use that function to move the subsurface instead. * surface.c (ApplyScale): Update comment. (ApplyViewport, CheckViewportValues): New functions. (HandleScaleChanged): Apply the viewport as well upon scale change. (ApplyDamage): Improve damage calculation for viewported surfaces. (SavePendingState, InternalCommit): Save and commit viewport state; check old values upon buffer commit. (InitState): Initialize viewport to initial values. (XLSurfaceRunFrameCallbacks): Handle overflows of 32-bit time at the 49-day mark. (SurfaceToWindow, ScaleToWindow, WindowToSurface, ScaleToSurface) (TruncateScaleToWindow, TruncateScaleToWindow) (TruncateWindowToSurface, TruncateScaleToSurface): New functions for handling scale. * xdg_popup.c (MoveWindow, IsWindowMapped, XLGetXdgPopup): * xdg_surface.c (IsRoleMapped, Commit, Subframe) (GetResizeDimensions, XLXdgRoleCalcNewWindowSize): * xdg_toplevel.c (IsWindowMapped, NoteConfigureTime, SendStates) (RecordStateSize, HandleWindowGeometryChange, NoteWindowPreResize) (XLGetXdgToplevel): Use them instead of manually multiplying with the factor.
102 lines
3.9 KiB
Text
102 lines
3.9 KiB
Text
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".
|
|
|
|
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
|
|
|
|
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, wayland-scanner, pixman, XCB, and
|
|
X extension libraries installed:
|
|
|
|
xmkmf # to generate the Makefile
|
|
make # to build the binary
|
|
|
|
Running the binary should be simple as well:
|
|
|
|
./12to11
|
|
|
|
Wayland programs will then run as regular X windows.
|