forked from 12to11/12to11
8 commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
![]() |
768f2d98b5 |
Implement buffer transforms on the XRender backend
* 12to11.conf (XSHMFENCELIB): New library. * 12to11.man: Document that surface transforms are now supported. * Imakefile (LOCAL_LIBRARIES): Add XSHMFENCELIB. (SRCS, OBJS): Add fence_ring.c and fence_ring.o. * README: Require xshmfence. * buffer.c: Include stdio.h. * compositor.h (enum _BufferTransform): New enum. (struct _DrawParams): Add TransformSet. (RotatesDimensions): New macro. (struct _State): Add buffer transform. * egl.c: Add TODO for buffer transforms. * fns.c (TransformBox, XLTransformRegion): New functions. * picture_renderer.c (struct _BufferActivityRecord): New field `fence'. (struct _PictureBuffer): Add buffer width and height. (struct _DmaBufRecord, RecordBufferActivity, UnlinkActivityRecord) (DestroyRenderTarget, GetBufferTransform, MaybeApplyTransform) (Composite, FinishRender, BufferFromDmaBuf, FinishDmaBufRecord) (BufferFromDmaBufAsync, BufferFromShm, FreeAnyBuffer): Record width and height, and handle transforms; add some disabled fencing code. * subcompositor.c (struct _View): Add transform. Rearrange fields for alignment. (MakeView): Initialize transform. (InvertTransform): New function. (BufferWidthAfterTransform, BufferHeightAfterTransform) (TransformBufferDamage): New functions. (ViewDamageBuffer): Transform buffer damage if necessary. (ViewWidth, ViewHeight): Use width and height after transform. (ViewComputeTransform): Apply transform. * surface.c (ApplyBufferTransform): New function. (ApplyViewport, CheckViewportValues, SavePendingState) (InternalCommit, GetBufferTransform, SetBufferTransform, InitState): Initialize and handle transforms. (XLStateAttachBuffer, XLStateDetachBuffer): Delete unused functions. * time.c (InitTime): Require a newer version of the Sync extension. * transform.c (MatrixRotate, MatrixMirrorHorizontal): New functions. |
||
![]() |
a63a7ebdd6 |
Fix frame timing prediction algorithm
* compositor.h (struct _RoleFuncs): Replace subframe with `subsurface_update'. * dmabuf.c (ExistingModifier): * fns.c (RebalanceBusfault): Pacify various compiler warnings. * frame_clock.c (struct _FrameClock, PostEndFrame) (XLFrameClockHandleFrameEvent, XLMakeFrameClockForWindow): Fix presentation logic. First, store absolute presentation timestamps. Secondly, use the frame_delay to adjust timestamps. * icon_surface.c (Subframe): Delete function. (SubsurfaceUpdate): New function. (EndSubframe): Delete function. (XLGetIconSurface): Change attached functions. * picture_renderer.c (struct _PictureTarget, RecordBufferActivity) (HandleActivityEvent, DestroyRenderTarget) (FillBoxesWithTransparency, Composite, FinishRender) (picture_render_funcs): Send roundtrip event only once, and flush upon FinishRender. * process.c (ProcessPendingDescriptions, RunProcess, ProcessPoll): Don't block signals where unnecessary. * seat.c (struct _Seat, CursorFromRole, ReleaseSeat, Subframe) (EndSubframe, MakeCurrentCursor, HandleBind, MakeSeatForDevicePair) (StartResizeTracking): * subsurface.c (Subframe, EndSubframe, Commit, Teardown) (GetSubsurface): * surface.c (HandleScaleChanged): * xdg_surface.c (CheckFrame, Commit, Subframe, SubsurfaceUpdate) (EndSubframe, XLGetXdgSurface): * xdg_toplevel.c (Unmap): Adjust for above changes, and fix some compiler warnings. |
||
![]() |
edfdc76f6d |
Implement idle_inhibit_unstable_v1
* 12to11.c (XLMain): Initialize idle inhibition. * 12to11.man: Document new resources. * Imakefile (SRCS): Add idle_inhibit.c and process.c. (OBJS): Add idle_inhibit.o and process.o. (idle-inhibit-unstable-v1): New scanner target. * README: Explain what is now supported. * compositor.h (enum _ClientDataType): Add IdleInhibitData. (struct _Surface): Keep track of the number of focused seats. * fns.c (UnblockSigbus): Fix unblocking of SIGBUS. (XLAddFdFlag): New function. * picture_renderer.c (GetRenderDevice): * seat.c (WriteKeymap): * drm_lease.c (AddProvider): Make various file descriptors close-on-exec. * run.c (RunStep): Change poll function to one that applies the result of SIGCHLD. * surface.c (XLSurfaceNoteFocus): Keep track of the number of focused seats and call idle inhibit hooks when that changes. |
||
![]() |
167001689a |
Fix bugs discovered by static analyzers and fix buffer damage calculation
* compositor.h (XLAssert): Make a macro. * dnd.c (HandleCirculateNotify, HandleReparentNotify): Fix NULL checks. (ReadProtocolProperties): Return suitable values for windows that aren't in the cache. * egl.c (HaveEglExtension1): Avoid redundant assignment to n. * fns.c (XLAssert): Delete function. * picture_renderer.c (GetRenderDevice): Remove redundant TODO. (BufferFromShm): Assert that pict_format is non-NULL. (ValidateShmParams): Likewise. * pointer_constraints.c (ApplyLines): Remove redundant assignment to i. * renderer.c (PickRenderer): Fix build with non-GCC compilers. * seat.c (ComputeHotspot): Return values when surface is NULL. (XLSeatExplicitlyGrabSurface): Don't save keyboard grab state. * shm.c (CreatePool): Close fd and return if pool could not be allocated. * subcompositor.c (GetContentScale): Move earlier. (ViewDamageBuffer, ViewGetContentScale): New functions. (SubcompositorUpdate): Remove redundant assignment. * surface.c (ApplyViewport): Make dest_width and dest_height double. (ApplyDamage): Call ViewDamageBuffer. (ScaleToWindow): * text_input.c (HandleNewIM): * xdg_toplevel.c (SendDecorationConfigure1, HandleWmStateChange) (HandleAllowedActionsChange, HandleDecorationResourceDestroy): Avoid NULL pointer dereferences in various cases. |
||
![]() |
4d2e85d002 |
Implement wp_viewporter support and fix scaling for fractional values
* 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. |
||
![]() |
ebcc957302 |
Implement explicit synchronization
* 12to11.c (XLMain): Initialize explicit synchronization. * Imakefile (SRCS, OBJS): Remove generated files. (ScannerTarget): New macro. (clean): Clean GENSRCS as well. (linux-dmabuf-unstable-v1.h): (linux-dmabuf-unstable-v1.c): (xdg-shell.h): (xdg-shell.c): (primary-selection-unstable-v1.h): (primary-selection-unstable-v1.c): Remove and replace with ScannerTarget. * README: Announce explicit synchronization support. * compositor.h (union _RenderFence): New union. (struct _RenderFuncs): Add fence functions. (struct _Surface): New fields for explicit synchronization objects and release callbacks. * egl.c (EglInitFuncs, EglInitGlFuncs, EglInitDisplay): Initialize functions and extensions used for explicit synchronization, and set render func flags. (ImportFdFence, WaitFence, DeleteFence, HandleFenceReadable) (GetFinishFence): New functions. (egl_render_funcs): Add those functions. (AddRenderFlag): New function. * fns.c (MaybeInstallBusHandler): Fix coding style. * picture_renderer.c (ImportFdFence, WaitFence, DeleteFence) (GetFinishFence): New stubs. (picture_render_funcs): Add those functions; they should never be called. * renderer.c (RenderImportFdFence): (RenderWaitFence): (RenderDeleteFence): (RenderGetFinishFence): New wrapper functions. * run.c (struct _PollFd, XLAddWriteFd, XLAddReadFd): Add pollfd field to callback args. (RunStep): Pass them to callbacks. Also, fix a comment. * surface.c (DoRelease): New function. (DestroySurface): Clear release if possible. (SavePendingState, TryEarlyRelease): Extract release code to DoRelease. (InternalCommit): Wait for sync fences before continuing. (Commit): Close acquire fence and release sync release object. (HandleSurfaceDestroy): Destroy release callback and close acquire fence. (XLCreateSurface): Clear acquire fence field with right initial value. * xdata.c (NoticeTransferWritable): (NoticeTransferReadable): (NoticeConversionTransferReadable): (NoticeConversionTransferWritable): Adjust arguments for new callback data. |
||
![]() |
b4ee06589e |
Add support for EGL, for YUV image formats
EGL support is still incomplete; stuff like scaling is missing. * 12to11.c (PickVisual, XLMain): Remove function. Initialize renderers, and rely on that to initialize the visuals. * 12to11.man: Document new environment variables. * Imakefile (SRCS, OBJS): Add picture_renderer.c and renderer.c and their associated objects. (GENHEADERS): New variable for generated headers. (EGL_SRCS, EGL_OBJS): New variables. (LOCAL_LIBRARIES, SRCS, OBJS, DEFINES): [HaveEglSupport]: Add EGL defines, libraries, and objects.:(shaders.h): New rule. (depend, cleandir): Depend on generated headers and SRCs. $($(OBJS)): Depend on $(GENHEADERS). * README: Write how to build with EGL support and update content descriptions. * buffer.c (XLPictureFromBuffer): Delete function. (XLRenderBufferFromBuffer): New function. (XLPixmapFromBuffer): Delete function. * compositor.h (enum _Operation, struct _SharedMemoryAttributes) (struct _DmaBufAttributes, union _RenderTarget) (union _RenderBuffer, struct _RenderFuncs, struct _DrmFormat) (struct _ShmFormat, struct _BufferFuncs, struct _ExtBufferFuncs): New structures. (Fallthrough): New define. Define to __attribute__ ((fallthrough)) wherever supported. Replace uses of Picture with RenderBuffer. * dmabuf.c (struct _DrmFormatInfo): Remove structures. (struct _BufferParams): Remove link. (struct _Buffer): Replace pixmap and picture with render buffer object. (dri3_opcode, all_formats, pending_success, next_roundtrip_id) (round_trip_window): Delete. (ReleaseBufferParams, HandleParamsResourceDestroy, ForceRoundTrip) (DepthForFormat, XLHandleErrorForDmabuf, PictFormatForFormat) (DestroyBacking, GetPictureFunc, GetPixmapFunc, GetBufferFunc) (CreateBufferFor, ModifierHigh, FinishBufferCreation) (XLHandleOneXEventForDmabuf, CreateHeader, Create, CreateImmed) (FindFormatMatching, FindSupportedModifiers, FindSupportedFormats) (SendSupportedFormats, HandleBind, InitDrmDevice, WriteFormatTable) (ReallyInitDmabuf, ReadSupportedFormats, XLInitDmabuf): Remove various functions and reimplement as a wrapper around the renderer abstraction, instead of DRI3. * fns.c (struct _Busfault): New structure. (busfault_tree, bus_handler_installed): New variables. (GetHeight, FixHeights, RotateLeft, RotateRight, RebalanceBusfault) (RecordBusfault, DetectBusfault, DeleteMin, RemoveBusfault) (HandleBusfault, MaybeInstallBusHandler, BlockSigbus) (UnblockSigbus, XLRecordBusfault, XLRemoveBusfaults): New functions to store non-overlapping regions of mapped memory in an AVL tree, and to ignore SIGBUS events that trap within. * icon_surface.c (struct _IconSurface): Replace picture with rendering target. (ReleaseBacking, XLGetIconSurface): Use rendering targets instead of pictures. * libraries.def: Add defines for EGL. * run.c (HandleOneXEvent): Replace old dmabuf code with renderer code. * seat.c (CursorFromRole, PictureForCursor, ApplyCursor) (UpdateCursorFromSubcompositor, Subframe, EndSubframe): Rewrite cursor code to use rendering targets and not pictures. * shm.c (Buffer, DereferencePool): Remove SIGBUS protection. (DereferenceBuffer): Reimplement in terms of renderer functions. (GetPictureFunc): Delete function. (GetBufferFunc): New function. (GetPixmapFunc): Delete function. (PrintBuffer): Remove now-broken implementation. (DepthForFormat, PictFormatForFormat): Delete functions, as they are now part of the rendering backend. (IsFormatSupported): New function. (CreateBuffer): Reimplement in terms of renderer functions. (ResizePool): Change SIGBUS protection for resize. (CreatePool): Protect buffer data from SIGBUS should a client truncate the file. (PostFormats): Reimplement in terms of RenderGetShmFormats. (XLInitShm): Stop initializing MIT-SHM. * subcompositor.c (IsTargetAttached): New flag and associated macros. (struct _View): Remove useless field. (struct _Subcompositor): Change target to RenderTarget. Add fields for prior damage. (MakeSubcompositor): Initialize new fields. (SubcompositorSetTarget): Accept RenderTarget, not picture, and set target attached flag. (ViewGetTransform): Delete function. (ViewApplyTransform): New function. (FillBoxesWithTransparency): Reimplement in terms of renderer functions. (StorePreviousDamage): New function. (SubcompositorUpdate): Reimplement in terms of renderer functions. Also, learn to deal with situations where the buffer reflects the state 1 to 2 swaps ago. (SubcompositorExpose): Reimplement in terms of renderer functions. (SubcompositorFree): Free new fields. (SubcompositorInit): Remove no longer required initialization of identity matrix. * xdata.c (ReceiveBody): Fix coding style. * xdg_surface.c (struct _XdgRole, ReleaseBacking, XLGetXdgSurface): Switch from pictures to RenderTargets. * xerror.c (ErrorHandler): Handle errors for picture renderer instead of dmabuf.c. |
||
![]() |
528f7ba858 | Import files |