chore(deps): pin cef2gtk dmabuf churn
- commit
- 94546f0ee3810084d5588fabd7481b1aabb9136a
- author
- brice · · 2026-07-14 16:10 UTC
- parent
- c5ad8c0
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
6 files · +165 -127
M go.mod +1 -1
| @@ -7,7 +7,7 @@ require ( | |||
| 7 | 7 | github.com/andybalholm/brotli v1.2.2 | |
| 8 | 8 | github.com/bnema/purego v0.11.0-bnema.4 | |
| 9 | 9 | github.com/bnema/purego-cef v0.13.4-0.20260714140305-f0b7414af67e | |
| 10 | - | github.com/bnema/purego-cef2gtk v0.8.4 | |
| 10 | + | github.com/bnema/purego-cef2gtk v0.8.4-0.20260714160309-bbd397409ebe | |
| 11 | 11 | github.com/bnema/purego-pipewire v0.1.5-0.20260714124450-6504b9cdf02a | |
| 12 | 12 | github.com/bnema/purego-sqlite v0.1.4-0.20260714131321-3614fe683b9c | |
| 13 | 13 | github.com/bnema/puregotk v0.7.0 | |
| @@ -7,7 +7,7 @@ require ( | |||||
| 7 | github.com/andybalholm/brotli v1.2.2 | 7 | github.com/andybalholm/brotli v1.2.2 | ||
| 8 | github.com/bnema/purego v0.11.0-bnema.4 | 8 | github.com/bnema/purego v0.11.0-bnema.4 | ||
| 9 | github.com/bnema/purego-cef v0.13.4-0.20260714140305-f0b7414af67e | 9 | github.com/bnema/purego-cef v0.13.4-0.20260714140305-f0b7414af67e | ||
| 10 | - | github.com/bnema/purego-cef2gtk v0.8.4 | 10 | + | github.com/bnema/purego-cef2gtk v0.8.4-0.20260714160309-bbd397409ebe |
| 11 | github.com/bnema/purego-pipewire v0.1.5-0.20260714124450-6504b9cdf02a | 11 | github.com/bnema/purego-pipewire v0.1.5-0.20260714124450-6504b9cdf02a | ||
| 12 | github.com/bnema/purego-sqlite v0.1.4-0.20260714131321-3614fe683b9c | 12 | github.com/bnema/purego-sqlite v0.1.4-0.20260714131321-3614fe683b9c | ||
| 13 | github.com/bnema/puregotk v0.7.0 | 13 | github.com/bnema/puregotk v0.7.0 | ||
M go.sum +2 -0 generated file: collapsed
M vendor/github.com/bnema/purego-cef2gtk/internal/cefadapter/accelerated_paint.go +34 -37
| @@ -16,57 +16,54 @@ var ( | |||
| 16 | 16 | ) | |
| 17 | 17 | ||
| 18 | 18 | // BorrowedFrameFromAcceleratedPaint converts CEF accelerated paint metadata to a | |
| 19 | - | // callback-scoped borrowed DMABUF frame description. | |
| 19 | + | // callback-scoped borrowed DMABUF frame description. New single-plane consumers | |
| 20 | + | // should use SinglePlaneFrameFromAcceleratedPaint to avoid allocating this slice. | |
| 20 | 21 | func BorrowedFrameFromAcceleratedPaint(info *cef.AcceleratedPaintInfo) (dmabuf.BorrowedFrame, error) { | |
| 22 | + | frame, err := SinglePlaneFrameFromAcceleratedPaint(info) | |
| 23 | + | if err != nil { | |
| 24 | + | return dmabuf.BorrowedFrame{}, err | |
| 25 | + | } | |
| 26 | + | return dmabuf.BorrowedFrame{ | |
| 27 | + | CodedSize: frame.CodedSize, | |
| 28 | + | VisibleRect: frame.VisibleRect, | |
| 29 | + | ContentRect: frame.ContentRect, | |
| 30 | + | SourceSize: frame.SourceSize, | |
| 31 | + | Format: frame.Format, | |
| 32 | + | Modifier: frame.Modifier, | |
| 33 | + | Planes: []dmabuf.Plane{frame.Plane}, | |
| 34 | + | }, nil | |
| 35 | + | } | |
| 36 | + | ||
| 37 | + | // SinglePlaneFrameFromAcceleratedPaint converts the supported one-plane CEF | |
| 38 | + | // metadata without allocating a plane slice. The returned FD is callback-scoped | |
| 39 | + | // and remains owned by CEF. | |
| 40 | + | func SinglePlaneFrameFromAcceleratedPaint(info *cef.AcceleratedPaintInfo) (dmabuf.SinglePlaneFrame, error) { | |
| 21 | 41 | if info == nil { | |
| 22 | - | return dmabuf.BorrowedFrame{}, ErrNilAcceleratedPaintInfo | |
| 42 | + | return dmabuf.SinglePlaneFrame{}, ErrNilAcceleratedPaintInfo | |
| 23 | 43 | } | |
| 24 | 44 | if info.PlaneCount != 1 { | |
| 25 | - | return dmabuf.BorrowedFrame{}, fmt.Errorf("%w: got %d, want 1", dmabuf.ErrUnsupportedPlanes, info.PlaneCount) | |
| 45 | + | return dmabuf.SinglePlaneFrame{}, fmt.Errorf("%w: got %d, want 1", dmabuf.ErrUnsupportedPlanes, info.PlaneCount) | |
| 26 | 46 | } | |
| 27 | - | ||
| 28 | - | planeCount := int(info.PlaneCount) | |
| 29 | - | planes := make([]dmabuf.Plane, planeCount) | |
| 30 | - | for i := 0; i < planeCount; i++ { | |
| 31 | - | plane := info.Planes[i] | |
| 32 | - | planes[i] = dmabuf.Plane{ | |
| 47 | + | plane := info.Planes[0] | |
| 48 | + | frame := dmabuf.SinglePlaneFrame{ | |
| 49 | + | CodedSize: dmabuf.Size{Width: info.Extra.CodedSize.Width, Height: info.Extra.CodedSize.Height}, | |
| 50 | + | VisibleRect: dmabuf.Rect{X: info.Extra.VisibleRect.X, Y: info.Extra.VisibleRect.Y, Width: info.Extra.VisibleRect.Width, Height: info.Extra.VisibleRect.Height}, | |
| 51 | + | ContentRect: dmabuf.Rect{X: info.Extra.ContentRect.X, Y: info.Extra.ContentRect.Y, Width: info.Extra.ContentRect.Width, Height: info.Extra.ContentRect.Height}, | |
| 52 | + | SourceSize: dmabuf.Size{Width: info.Extra.SourceSize.Width, Height: info.Extra.SourceSize.Height}, | |
| 53 | + | Format: dmabufFormatFromCEFColorType(cef.ColorType(info.Format)), | |
| 54 | + | Modifier: info.Modifier, | |
| 55 | + | Plane: dmabuf.Plane{ | |
| 33 | 56 | FD: int(plane.Fd), | |
| 34 | 57 | Stride: plane.Stride, | |
| 35 | 58 | Offset: plane.Offset, | |
| 36 | 59 | Size: plane.Size, | |
| 37 | - | } | |
| 38 | - | } | |
| 39 | - | ||
| 40 | - | frame := dmabuf.BorrowedFrame{ | |
| 41 | - | CodedSize: dmabuf.Size{ | |
| 42 | - | Width: info.Extra.CodedSize.Width, | |
| 43 | - | Height: info.Extra.CodedSize.Height, | |
| 44 | - | }, | |
| 45 | - | VisibleRect: dmabuf.Rect{ | |
| 46 | - | X: info.Extra.VisibleRect.X, | |
| 47 | - | Y: info.Extra.VisibleRect.Y, | |
| 48 | - | Width: info.Extra.VisibleRect.Width, | |
| 49 | - | Height: info.Extra.VisibleRect.Height, | |
| 50 | - | }, | |
| 51 | - | ContentRect: dmabuf.Rect{ | |
| 52 | - | X: info.Extra.ContentRect.X, | |
| 53 | - | Y: info.Extra.ContentRect.Y, | |
| 54 | - | Width: info.Extra.ContentRect.Width, | |
| 55 | - | Height: info.Extra.ContentRect.Height, | |
| 56 | 60 | }, | |
| 57 | - | SourceSize: dmabuf.Size{ | |
| 58 | - | Width: info.Extra.SourceSize.Width, | |
| 59 | - | Height: info.Extra.SourceSize.Height, | |
| 60 | - | }, | |
| 61 | - | Format: dmabufFormatFromCEFColorType(cef.ColorType(info.Format)), | |
| 62 | - | Modifier: info.Modifier, | |
| 63 | - | Planes: planes, | |
| 64 | 61 | } | |
| 65 | 62 | if frame.Format == 0 { | |
| 66 | - | return dmabuf.BorrowedFrame{}, fmt.Errorf("%w: %d", ErrUnsupportedColorType, info.Format) | |
| 63 | + | return dmabuf.SinglePlaneFrame{}, fmt.Errorf("%w: %d", ErrUnsupportedColorType, info.Format) | |
| 67 | 64 | } | |
| 68 | 65 | if err := frame.Validate(); err != nil { | |
| 69 | - | return dmabuf.BorrowedFrame{}, err | |
| 66 | + | return dmabuf.SinglePlaneFrame{}, err | |
| 70 | 67 | } | |
| 71 | 68 | return frame, nil | |
| 72 | 69 | } | |
| @@ -16,57 +16,54 @@ var ( | |||||
| 16 | ) | 16 | ) | ||
| 17 | 17 | ||||
| 18 | // BorrowedFrameFromAcceleratedPaint converts CEF accelerated paint metadata to a | 18 | // BorrowedFrameFromAcceleratedPaint converts CEF accelerated paint metadata to a | ||
| 19 | - | // callback-scoped borrowed DMABUF frame description. | 19 | + | // callback-scoped borrowed DMABUF frame description. New single-plane consumers |
| 20 | + | // should use SinglePlaneFrameFromAcceleratedPaint to avoid allocating this slice. | |||
| 20 | func BorrowedFrameFromAcceleratedPaint(info *cef.AcceleratedPaintInfo) (dmabuf.BorrowedFrame, error) { | 21 | func BorrowedFrameFromAcceleratedPaint(info *cef.AcceleratedPaintInfo) (dmabuf.BorrowedFrame, error) { | ||
| 22 | + | frame, err := SinglePlaneFrameFromAcceleratedPaint(info) | |||
| 23 | + | if err != nil { | |||
| 24 | + | return dmabuf.BorrowedFrame{}, err | |||
| 25 | + | } | |||
| 26 | + | return dmabuf.BorrowedFrame{ | |||
| 27 | + | CodedSize: frame.CodedSize, | |||
| 28 | + | VisibleRect: frame.VisibleRect, | |||
| 29 | + | ContentRect: frame.ContentRect, | |||
| 30 | + | SourceSize: frame.SourceSize, | |||
| 31 | + | Format: frame.Format, | |||
| 32 | + | Modifier: frame.Modifier, | |||
| 33 | + | Planes: []dmabuf.Plane{frame.Plane}, | |||
| 34 | + | }, nil | |||
| 35 | + | } | |||
| 36 | + | ||||
| 37 | + | // SinglePlaneFrameFromAcceleratedPaint converts the supported one-plane CEF | |||
| 38 | + | // metadata without allocating a plane slice. The returned FD is callback-scoped | |||
| 39 | + | // and remains owned by CEF. | |||
| 40 | + | func SinglePlaneFrameFromAcceleratedPaint(info *cef.AcceleratedPaintInfo) (dmabuf.SinglePlaneFrame, error) { | |||
| 21 | if info == nil { | 41 | if info == nil { | ||
| 22 | - | return dmabuf.BorrowedFrame{}, ErrNilAcceleratedPaintInfo | 42 | + | return dmabuf.SinglePlaneFrame{}, ErrNilAcceleratedPaintInfo |
| 23 | } | 43 | } | ||
| 24 | if info.PlaneCount != 1 { | 44 | if info.PlaneCount != 1 { | ||
| 25 | - | return dmabuf.BorrowedFrame{}, fmt.Errorf("%w: got %d, want 1", dmabuf.ErrUnsupportedPlanes, info.PlaneCount) | 45 | + | return dmabuf.SinglePlaneFrame{}, fmt.Errorf("%w: got %d, want 1", dmabuf.ErrUnsupportedPlanes, info.PlaneCount) |
| 26 | } | 46 | } | ||
| 27 | - | 47 | + | plane := info.Planes[0] | |
| 28 | - | planeCount := int(info.PlaneCount) | 48 | + | frame := dmabuf.SinglePlaneFrame{ |
| 29 | - | planes := make([]dmabuf.Plane, planeCount) | 49 | + | CodedSize: dmabuf.Size{Width: info.Extra.CodedSize.Width, Height: info.Extra.CodedSize.Height}, |
| 30 | - | for i := 0; i < planeCount; i++ { | 50 | + | VisibleRect: dmabuf.Rect{X: info.Extra.VisibleRect.X, Y: info.Extra.VisibleRect.Y, Width: info.Extra.VisibleRect.Width, Height: info.Extra.VisibleRect.Height}, |
| 31 | - | plane := info.Planes[i] | 51 | + | ContentRect: dmabuf.Rect{X: info.Extra.ContentRect.X, Y: info.Extra.ContentRect.Y, Width: info.Extra.ContentRect.Width, Height: info.Extra.ContentRect.Height}, |
| 32 | - | planes[i] = dmabuf.Plane{ | 52 | + | SourceSize: dmabuf.Size{Width: info.Extra.SourceSize.Width, Height: info.Extra.SourceSize.Height}, |
| 53 | + | Format: dmabufFormatFromCEFColorType(cef.ColorType(info.Format)), | |||
| 54 | + | Modifier: info.Modifier, | |||
| 55 | + | Plane: dmabuf.Plane{ | |||
| 33 | FD: int(plane.Fd), | 56 | FD: int(plane.Fd), | ||
| 34 | Stride: plane.Stride, | 57 | Stride: plane.Stride, | ||
| 35 | Offset: plane.Offset, | 58 | Offset: plane.Offset, | ||
| 36 | Size: plane.Size, | 59 | Size: plane.Size, | ||
| 37 | - | } | |||
| 38 | - | } | |||
| 39 | - | ||||
| 40 | - | frame := dmabuf.BorrowedFrame{ | |||
| 41 | - | CodedSize: dmabuf.Size{ | |||
| 42 | - | Width: info.Extra.CodedSize.Width, | |||
| 43 | - | Height: info.Extra.CodedSize.Height, | |||
| 44 | - | }, | |||
| 45 | - | VisibleRect: dmabuf.Rect{ | |||
| 46 | - | X: info.Extra.VisibleRect.X, | |||
| 47 | - | Y: info.Extra.VisibleRect.Y, | |||
| 48 | - | Width: info.Extra.VisibleRect.Width, | |||
| 49 | - | Height: info.Extra.VisibleRect.Height, | |||
| 50 | - | }, | |||
| 51 | - | ContentRect: dmabuf.Rect{ | |||
| 52 | - | X: info.Extra.ContentRect.X, | |||
| 53 | - | Y: info.Extra.ContentRect.Y, | |||
| 54 | - | Width: info.Extra.ContentRect.Width, | |||
| 55 | - | Height: info.Extra.ContentRect.Height, | |||
| 56 | }, | 60 | }, | ||
| 57 | - | SourceSize: dmabuf.Size{ | |||
| 58 | - | Width: info.Extra.SourceSize.Width, | |||
| 59 | - | Height: info.Extra.SourceSize.Height, | |||
| 60 | - | }, | |||
| 61 | - | Format: dmabufFormatFromCEFColorType(cef.ColorType(info.Format)), | |||
| 62 | - | Modifier: info.Modifier, | |||
| 63 | - | Planes: planes, | |||
| 64 | } | 61 | } | ||
| 65 | if frame.Format == 0 { | 62 | if frame.Format == 0 { | ||
| 66 | - | return dmabuf.BorrowedFrame{}, fmt.Errorf("%w: %d", ErrUnsupportedColorType, info.Format) | 63 | + | return dmabuf.SinglePlaneFrame{}, fmt.Errorf("%w: %d", ErrUnsupportedColorType, info.Format) |
| 67 | } | 64 | } | ||
| 68 | if err := frame.Validate(); err != nil { | 65 | if err := frame.Validate(); err != nil { | ||
| 69 | - | return dmabuf.BorrowedFrame{}, err | 66 | + | return dmabuf.SinglePlaneFrame{}, err |
| 70 | } | 67 | } | ||
| 71 | return frame, nil | 68 | return frame, nil | ||
| 72 | } | 69 | } | ||