ExtFb: pass params in vectors
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 10 Feb 2017 05:33:55 +0000 (07:33 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 10 Feb 2017 08:55:12 +0000 (10:55 +0200)
kms++/inc/kms++/extframebuffer.h
kms++/src/extframebuffer.cpp
kmscube/cube-gbm.cpp
utils/kmscapture.cpp

index 89551c3c30d332cf695147594c9a801170079f78..cee82d3e6b9068c119c0610fa9ced195162ce59c 100644 (file)
@@ -10,9 +10,9 @@ class ExtFramebuffer : public MappedFramebuffer
 {
 public:
        ExtFramebuffer(Card& card, uint32_t width, uint32_t height, PixelFormat format,
-                      uint32_t handles[4], uint32_t pitches[4], uint32_t offsets[4]);
+                      std::vector<uint32_t> handles, std::vector<uint32_t> pitches, std::vector<uint32_t> offsets);
        ExtFramebuffer(Card& card, uint32_t width, uint32_t height, PixelFormat format,
-                      int fds[4], uint32_t pitches[4], uint32_t offsets[4]);
+                      std::vector<int> fds, std::vector<uint32_t> pitches, std::vector<uint32_t> offsets);
        virtual ~ExtFramebuffer();
 
        uint32_t width() const { return Framebuffer::width(); }
index 2f23a33ed538e7c793827feff640fe03265b3f5f..51f361173823a0ef55b32dfe1328be47014731cf 100644 (file)
@@ -13,7 +13,7 @@ namespace kms
 {
 
 ExtFramebuffer::ExtFramebuffer(Card& card, uint32_t width, uint32_t height, PixelFormat format,
-                              uint32_t handles[], uint32_t pitches[], uint32_t offsets[])
+                              vector<uint32_t> handles, vector<uint32_t> pitches, vector<uint32_t> offsets)
        : MappedFramebuffer(card, width, height)
 {
        m_format = format;
@@ -35,7 +35,7 @@ ExtFramebuffer::ExtFramebuffer(Card& card, uint32_t width, uint32_t height, Pixe
        }
 
        uint32_t id;
-       int r = drmModeAddFB2(card.fd(), width, height, (uint32_t)format, handles, pitches, offsets, &id, 0);
+       int r = drmModeAddFB2(card.fd(), width, height, (uint32_t)format, handles.data(), pitches.data(), offsets.data(), &id, 0);
        if (r)
                throw std::invalid_argument(string("Failed to create ExtFramebuffer: ") + strerror(r));
 
@@ -43,7 +43,7 @@ ExtFramebuffer::ExtFramebuffer(Card& card, uint32_t width, uint32_t height, Pixe
 }
 
 ExtFramebuffer::ExtFramebuffer(Card& card, uint32_t width, uint32_t height, PixelFormat format,
-                              int fds[4], uint32_t pitches[4], uint32_t offsets[4])
+                              vector<int> fds, vector<uint32_t> pitches, vector<uint32_t> offsets)
        : MappedFramebuffer(card, width, height)
 {
        int r;
@@ -72,7 +72,7 @@ ExtFramebuffer::ExtFramebuffer(Card& card, uint32_t width, uint32_t height, Pixe
        uint32_t id;
        uint32_t bo_handles[4] = { m_planes[0].handle, m_planes[1].handle };
        r = drmModeAddFB2(card.fd(), width, height, (uint32_t)format,
-                         bo_handles, pitches, offsets, &id, 0);
+                         bo_handles, pitches.data(), offsets.data(), &id, 0);
        if (r)
                throw invalid_argument(string("drmModeAddFB2 failed: ") + strerror(errno));
 
index 993434b186370429553e049efcc819b8cdf341f3..07413ab9779f37e4ceffbc9af7568566146caf11 100644 (file)
@@ -134,9 +134,9 @@ public:
                uint32_t handle = gbm_bo_get_handle(bo).u32;
                PixelFormat format = (PixelFormat)gbm_bo_get_format(bo);
 
-               uint32_t handles[4] { handle };
-               uint32_t strides[4] { stride };
-               uint32_t offsets[4] { 0 };
+               vector<uint32_t> handles { handle };
+               vector<uint32_t> strides { stride };
+               vector<uint32_t> offsets { 0 };
 
                fb = new ExtFramebuffer(card, width, height, format, handles, strides, offsets);
 
index b4c3e881f1393a4f14aa564bd3d1acc88ba341a4..43ef9899dd9d3de313834c6cf0bffef7c7608a7b 100644 (file)
@@ -83,9 +83,9 @@ ExtFramebuffer* CameraPipeline::GetExtFrameBuffer(Card& card, uint32_t i, PixelF
        const PixelFormatInfo& format_info = get_pixel_format_info(pixfmt);
        ASSERT(format_info.num_planes == 1);
 
-       uint32_t handles[4] { handle };
-       uint32_t pitches[4] { m_in_width * (format_info.planes[0].bitspp / 8) };
-       uint32_t offsets[4] { };
+       vector<uint32_t> handles { handle };
+       vector<uint32_t> pitches { m_in_width * (format_info.planes[0].bitspp / 8) };
+       vector<uint32_t> offsets { };
 
        return new ExtFramebuffer(card, m_in_width, m_in_height, pixfmt,
                                  handles, pitches, offsets);