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 generated file: collapsed
M vendor/github.com/bnema/purego-cef2gtk/internal/dmabuf/frame.go +38 -19
| @@ -59,6 +59,20 @@ type BorrowedFrame struct { | |||
| 59 | 59 | Planes []Plane | |
| 60 | 60 | } | |
| 61 | 61 | ||
| 62 | + | // SinglePlaneFrame is the allocation-free representation for the only DMABUF | |
| 63 | + | // layout currently supported by the GDK renderer. Its FD remains owned by CEF. | |
| 64 | + | type SinglePlaneFrame struct { | |
| 65 | + | CodedSize Size | |
| 66 | + | ||
| 67 | + | VisibleRect Rect | |
| 68 | + | ContentRect Rect | |
| 69 | + | SourceSize Size | |
| 70 | + | ||
| 71 | + | Format FourCC | |
| 72 | + | Modifier uint64 | |
| 73 | + | Plane Plane | |
| 74 | + | } | |
| 75 | + | ||
| 62 | 76 | // checkedMulUint64 returns a*b and a boolean indicating whether the result is valid | |
| 63 | 77 | // (false on overflow). A zero result is always valid. | |
| 64 | 78 | func checkedMulUint64(a, b uint64) (uint64, bool) { | |
| @@ -80,16 +94,25 @@ func checkedAddUint64(a, b uint64) (uint64, bool) { | |||
| 80 | 94 | // plane, one of four RGB formats, positive coded size, non-negative fd, non-zero stride, | |
| 81 | 95 | // and overflow-safe plane extent bounds. | |
| 82 | 96 | func (f BorrowedFrame) Validate() error { | |
| 83 | - | if !f.CodedSize.Valid() { | |
| 84 | - | return fmt.Errorf("%w: %dx%d", ErrInvalidCodedSize, f.CodedSize.Width, f.CodedSize.Height) | |
| 85 | - | } | |
| 86 | - | if !f.Format.Supported() { | |
| 87 | - | return fmt.Errorf("%w: %s", ErrUnsupportedFormat, f.Format) | |
| 88 | - | } | |
| 89 | 97 | if len(f.Planes) != supportedPlaneCount { | |
| 90 | 98 | return fmt.Errorf("%w: got %d, want %d", ErrUnsupportedPlanes, len(f.Planes), supportedPlaneCount) | |
| 91 | 99 | } | |
| 92 | - | plane := f.Planes[0] | |
| 100 | + | return validateSinglePlaneFrame(f.CodedSize, f.Format, f.Planes[0]) | |
| 101 | + | } | |
| 102 | + | ||
| 103 | + | // Validate applies the same support and bounds checks as BorrowedFrame.Validate | |
| 104 | + | // without requiring a heap-backed plane slice. | |
| 105 | + | func (f SinglePlaneFrame) Validate() error { | |
| 106 | + | return validateSinglePlaneFrame(f.CodedSize, f.Format, f.Plane) | |
| 107 | + | } | |
| 108 | + | ||
| 109 | + | func validateSinglePlaneFrame(codedSize Size, format FourCC, plane Plane) error { | |
| 110 | + | if !codedSize.Valid() { | |
| 111 | + | return fmt.Errorf("%w: %dx%d", ErrInvalidCodedSize, codedSize.Width, codedSize.Height) | |
| 112 | + | } | |
| 113 | + | if !format.Supported() { | |
| 114 | + | return fmt.Errorf("%w: %s", ErrUnsupportedFormat, format) | |
| 115 | + | } | |
| 93 | 116 | if plane.FD < 0 { | |
| 94 | 117 | return fmt.Errorf("%w: %d", ErrInvalidPlaneFD, plane.FD) | |
| 95 | 118 | } | |
| @@ -97,29 +120,25 @@ func (f BorrowedFrame) Validate() error { | |||
| 97 | 120 | return fmt.Errorf("%w: %d", ErrInvalidStride, plane.Stride) | |
| 98 | 121 | } | |
| 99 | 122 | ||
| 100 | - | // Stride must be wide enough for one coded row at the format's bpp. | |
| 101 | - | bpp := uint64(f.Format.BytesPerPixel()) | |
| 102 | - | minStride, ok := checkedMulUint64(uint64(f.CodedSize.Width), bpp) | |
| 123 | + | bpp := uint64(format.BytesPerPixel()) | |
| 124 | + | minStride, ok := checkedMulUint64(uint64(codedSize.Width), bpp) | |
| 103 | 125 | if !ok { | |
| 104 | - | return fmt.Errorf("%w: width %d * %d bytes-per-pixel overflows uint64", ErrPlaneExtentOverflow, f.CodedSize.Width, bpp) | |
| 126 | + | return fmt.Errorf("%w: width %d * %d bytes-per-pixel overflows uint64", ErrPlaneExtentOverflow, codedSize.Width, bpp) | |
| 105 | 127 | } | |
| 106 | 128 | if uint64(plane.Stride) < minStride { | |
| 107 | - | return fmt.Errorf("%w: stride %d < minimum %d (width %d * %d bytes-per-pixel)", ErrInvalidStride, plane.Stride, minStride, f.CodedSize.Width, bpp) | |
| 129 | + | return fmt.Errorf("%w: stride %d < minimum %d (width %d * %d bytes-per-pixel)", ErrInvalidStride, plane.Stride, minStride, codedSize.Width, bpp) | |
| 108 | 130 | } | |
| 109 | 131 | ||
| 110 | - | // Overflow-safe minimum buffer extent validation. | |
| 111 | - | stride := uint64(plane.Stride) | |
| 112 | - | height := uint64(f.CodedSize.Height) | |
| 113 | - | rowBytes, ok := checkedMulUint64(stride, height) | |
| 132 | + | rowBytes, ok := checkedMulUint64(uint64(plane.Stride), uint64(codedSize.Height)) | |
| 114 | 133 | if !ok { | |
| 115 | - | return fmt.Errorf("%w: stride %d * coded height %d overflows uint64", ErrPlaneExtentOverflow, plane.Stride, f.CodedSize.Height) | |
| 134 | + | return fmt.Errorf("%w: stride %d * coded height %d overflows uint64", ErrPlaneExtentOverflow, plane.Stride, codedSize.Height) | |
| 116 | 135 | } | |
| 117 | 136 | requiredExtent, ok := checkedAddUint64(plane.Offset, rowBytes) | |
| 118 | 137 | if !ok { | |
| 119 | - | return fmt.Errorf("%w: offset %d + stride*coded height %d overflows uint64", ErrPlaneExtentOverflow, plane.Offset, rowBytes) | |
| 138 | + | return fmt.Errorf("%w: offset %d + stride*coded height %d overflows uint64", ErrPlaneExtentOverflow, plane.Offset, codedSize.Height) | |
| 120 | 139 | } | |
| 121 | 140 | if plane.Size > 0 && plane.Size < requiredExtent { | |
| 122 | - | return fmt.Errorf("%w: plane size %d < required minimum extent %d (offset %d + stride %d * coded height %d)", ErrPlaneSizeTooSmall, plane.Size, requiredExtent, plane.Offset, plane.Stride, f.CodedSize.Height) | |
| 141 | + | return fmt.Errorf("%w: plane size %d < required minimum extent %d (offset %d + stride %d * coded height %d)", ErrPlaneSizeTooSmall, plane.Size, requiredExtent, plane.Offset, plane.Stride, codedSize.Height) | |
| 123 | 142 | } | |
| 124 | 143 | return nil | |
| 125 | 144 | } | |
| @@ -59,6 +59,20 @@ type BorrowedFrame struct { | |||||
| 59 | Planes []Plane | 59 | Planes []Plane | ||
| 60 | } | 60 | } | ||
| 61 | 61 | ||||
| 62 | + | // SinglePlaneFrame is the allocation-free representation for the only DMABUF | |||
| 63 | + | // layout currently supported by the GDK renderer. Its FD remains owned by CEF. | |||
| 64 | + | type SinglePlaneFrame struct { | |||
| 65 | + | CodedSize Size | |||
| 66 | + | ||||
| 67 | + | VisibleRect Rect | |||
| 68 | + | ContentRect Rect | |||
| 69 | + | SourceSize Size | |||
| 70 | + | ||||
| 71 | + | Format FourCC | |||
| 72 | + | Modifier uint64 | |||
| 73 | + | Plane Plane | |||
| 74 | + | } | |||
| 75 | + | ||||
| 62 | // checkedMulUint64 returns a*b and a boolean indicating whether the result is valid | 76 | // checkedMulUint64 returns a*b and a boolean indicating whether the result is valid | ||
| 63 | // (false on overflow). A zero result is always valid. | 77 | // (false on overflow). A zero result is always valid. | ||
| 64 | func checkedMulUint64(a, b uint64) (uint64, bool) { | 78 | func checkedMulUint64(a, b uint64) (uint64, bool) { | ||
| @@ -80,16 +94,25 @@ func checkedAddUint64(a, b uint64) (uint64, bool) { | |||||
| 80 | // plane, one of four RGB formats, positive coded size, non-negative fd, non-zero stride, | 94 | // plane, one of four RGB formats, positive coded size, non-negative fd, non-zero stride, | ||
| 81 | // and overflow-safe plane extent bounds. | 95 | // and overflow-safe plane extent bounds. | ||
| 82 | func (f BorrowedFrame) Validate() error { | 96 | func (f BorrowedFrame) Validate() error { | ||
| 83 | - | if !f.CodedSize.Valid() { | |||
| 84 | - | return fmt.Errorf("%w: %dx%d", ErrInvalidCodedSize, f.CodedSize.Width, f.CodedSize.Height) | |||
| 85 | - | } | |||
| 86 | - | if !f.Format.Supported() { | |||
| 87 | - | return fmt.Errorf("%w: %s", ErrUnsupportedFormat, f.Format) | |||
| 88 | - | } | |||
| 89 | if len(f.Planes) != supportedPlaneCount { | 97 | if len(f.Planes) != supportedPlaneCount { | ||
| 90 | return fmt.Errorf("%w: got %d, want %d", ErrUnsupportedPlanes, len(f.Planes), supportedPlaneCount) | 98 | return fmt.Errorf("%w: got %d, want %d", ErrUnsupportedPlanes, len(f.Planes), supportedPlaneCount) | ||
| 91 | } | 99 | } | ||
| 92 | - | plane := f.Planes[0] | 100 | + | return validateSinglePlaneFrame(f.CodedSize, f.Format, f.Planes[0]) |
| 101 | + | } | |||
| 102 | + | ||||
| 103 | + | // Validate applies the same support and bounds checks as BorrowedFrame.Validate | |||
| 104 | + | // without requiring a heap-backed plane slice. | |||
| 105 | + | func (f SinglePlaneFrame) Validate() error { | |||
| 106 | + | return validateSinglePlaneFrame(f.CodedSize, f.Format, f.Plane) | |||
| 107 | + | } | |||
| 108 | + | ||||
| 109 | + | func validateSinglePlaneFrame(codedSize Size, format FourCC, plane Plane) error { | |||
| 110 | + | if !codedSize.Valid() { | |||
| 111 | + | return fmt.Errorf("%w: %dx%d", ErrInvalidCodedSize, codedSize.Width, codedSize.Height) | |||
| 112 | + | } | |||
| 113 | + | if !format.Supported() { | |||
| 114 | + | return fmt.Errorf("%w: %s", ErrUnsupportedFormat, format) | |||
| 115 | + | } | |||
| 93 | if plane.FD < 0 { | 116 | if plane.FD < 0 { | ||
| 94 | return fmt.Errorf("%w: %d", ErrInvalidPlaneFD, plane.FD) | 117 | return fmt.Errorf("%w: %d", ErrInvalidPlaneFD, plane.FD) | ||
| 95 | } | 118 | } | ||
| @@ -97,29 +120,25 @@ func (f BorrowedFrame) Validate() error { | |||||
| 97 | return fmt.Errorf("%w: %d", ErrInvalidStride, plane.Stride) | 120 | return fmt.Errorf("%w: %d", ErrInvalidStride, plane.Stride) | ||
| 98 | } | 121 | } | ||
| 99 | 122 | ||||
| 100 | - | // Stride must be wide enough for one coded row at the format's bpp. | 123 | + | bpp := uint64(format.BytesPerPixel()) |
| 101 | - | bpp := uint64(f.Format.BytesPerPixel()) | 124 | + | minStride, ok := checkedMulUint64(uint64(codedSize.Width), bpp) |
| 102 | - | minStride, ok := checkedMulUint64(uint64(f.CodedSize.Width), bpp) | |||
| 103 | if !ok { | 125 | if !ok { | ||
| 104 | - | return fmt.Errorf("%w: width %d * %d bytes-per-pixel overflows uint64", ErrPlaneExtentOverflow, f.CodedSize.Width, bpp) | 126 | + | return fmt.Errorf("%w: width %d * %d bytes-per-pixel overflows uint64", ErrPlaneExtentOverflow, codedSize.Width, bpp) |
| 105 | } | 127 | } | ||
| 106 | if uint64(plane.Stride) < minStride { | 128 | if uint64(plane.Stride) < minStride { | ||
| 107 | - | return fmt.Errorf("%w: stride %d < minimum %d (width %d * %d bytes-per-pixel)", ErrInvalidStride, plane.Stride, minStride, f.CodedSize.Width, bpp) | 129 | + | return fmt.Errorf("%w: stride %d < minimum %d (width %d * %d bytes-per-pixel)", ErrInvalidStride, plane.Stride, minStride, codedSize.Width, bpp) |
| 108 | } | 130 | } | ||
| 109 | 131 | ||||
| 110 | - | // Overflow-safe minimum buffer extent validation. | 132 | + | rowBytes, ok := checkedMulUint64(uint64(plane.Stride), uint64(codedSize.Height)) |
| 111 | - | stride := uint64(plane.Stride) | |||
| 112 | - | height := uint64(f.CodedSize.Height) | |||
| 113 | - | rowBytes, ok := checkedMulUint64(stride, height) | |||
| 114 | if !ok { | 133 | if !ok { | ||
| 115 | - | return fmt.Errorf("%w: stride %d * coded height %d overflows uint64", ErrPlaneExtentOverflow, plane.Stride, f.CodedSize.Height) | 134 | + | return fmt.Errorf("%w: stride %d * coded height %d overflows uint64", ErrPlaneExtentOverflow, plane.Stride, codedSize.Height) |
| 116 | } | 135 | } | ||
| 117 | requiredExtent, ok := checkedAddUint64(plane.Offset, rowBytes) | 136 | requiredExtent, ok := checkedAddUint64(plane.Offset, rowBytes) | ||
| 118 | if !ok { | 137 | if !ok { | ||
| 119 | - | return fmt.Errorf("%w: offset %d + stride*coded height %d overflows uint64", ErrPlaneExtentOverflow, plane.Offset, rowBytes) | 138 | + | return fmt.Errorf("%w: offset %d + stride*coded height %d overflows uint64", ErrPlaneExtentOverflow, plane.Offset, codedSize.Height) |
| 120 | } | 139 | } | ||
| 121 | if plane.Size > 0 && plane.Size < requiredExtent { | 140 | if plane.Size > 0 && plane.Size < requiredExtent { | ||
| 122 | - | return fmt.Errorf("%w: plane size %d < required minimum extent %d (offset %d + stride %d * coded height %d)", ErrPlaneSizeTooSmall, plane.Size, requiredExtent, plane.Offset, plane.Stride, f.CodedSize.Height) | 141 | + | return fmt.Errorf("%w: plane size %d < required minimum extent %d (offset %d + stride %d * coded height %d)", ErrPlaneSizeTooSmall, plane.Size, requiredExtent, plane.Offset, plane.Stride, codedSize.Height) |
| 123 | } | 142 | } | ||
| 124 | return nil | 143 | return nil | ||
| 125 | } | 144 | } | ||