summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ideasonboard.com>2025-02-05 11:28:23 +0200
committerTomi Valkeinen <tomi.valkeinen@ideasonboard.com>2025-03-26 15:44:00 +0200
commita9e7ecab862183399c5947931f2bad69ecec393d (patch)
tree6c02b4e7a4cb19f9af1421afccd87eef1b084d3a /py
parent8b1c053359ed7593e43222daccb8c0db8fcc441f (diff)
PixelFormats: New PixelFormatInfo code
New pixel format code, from Python pixutils library. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Diffstat (limited to 'py')
-rw-r--r--py/pykms/pykmsbase.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/py/pykms/pykmsbase.cpp b/py/pykms/pykmsbase.cpp
index 254dce6..ae8aebf 100644
--- a/py/pykms/pykmsbase.cpp
+++ b/py/pykms/pykmsbase.cpp
@@ -179,7 +179,7 @@ void init_pykmsbase(py::module& m)
if (plane >= format_info.num_planes)
throw runtime_error("map: bad plane number");
- array<uint32_t, 2> shape{ self.height(), self.width() * format_info.planes[plane].bitspp / 8 };
+ array<uint32_t, 2> shape{ self.height(), format_info.stride(self.width(), plane) };
array<uint32_t, 2> strides{ self.stride(plane), sizeof(uint8_t) };
return py::memoryview::from_buffer(self.map(plane), shape, strides);
@@ -311,9 +311,10 @@ void init_pykmsbase(py::module& m)
.def("commit_sync", &AtomicReq::commit_sync, py::arg("allow_modeset") = false);
py::class_<PixelFormatPlaneInfo>(m, "PixelFormatPlaneInfo")
- .def_readonly("bitspp", &PixelFormatPlaneInfo::bitspp)
- .def_readonly("xsub", &PixelFormatPlaneInfo::xsub)
- .def_readonly("ysub", &PixelFormatPlaneInfo::ysub);
+ .def_readonly("bytes_per_block", &PixelFormatPlaneInfo::bytes_per_block)
+ .def_readonly("pixels_per_block", &PixelFormatPlaneInfo::pixels_per_block)
+ .def_readonly("hsub", &PixelFormatPlaneInfo::hsub)
+ .def_readonly("vsub", &PixelFormatPlaneInfo::vsub);
py::class_<PixelFormatInfo>(m, "PixelFormatInfo")
.def_readonly("num_planes", &PixelFormatInfo::num_planes)