summaryrefslogtreecommitdiff
path: root/kms++/src
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2020-10-07 08:58:35 +0300
committerTomi Valkeinen <tomi.valkeinen@ti.com>2020-10-09 15:54:43 +0300
commitd9a1ffe56d0beb9cdd048d0e83f7d0177b31411a (patch)
tree6227b71ee23bfa344b4cd5896ec485409158a0bc /kms++/src
parent37d27443432b7b84d256bd5a7c505e7ef8e09bbd (diff)
Bulk format of all files
Diffstat (limited to 'kms++/src')
-rw-r--r--kms++/src/atomicreq.cpp57
-rw-r--r--kms++/src/blob.cpp3
-rw-r--r--kms++/src/card.cpp55
-rw-r--r--kms++/src/connector.cpp19
-rw-r--r--kms++/src/crtc.cpp24
-rw-r--r--kms++/src/dmabufframebuffer.cpp13
-rw-r--r--kms++/src/drmobject.cpp8
-rw-r--r--kms++/src/drmpropobject.cpp6
-rw-r--r--kms++/src/dumbframebuffer.cpp31
-rw-r--r--kms++/src/encoder.cpp15
-rw-r--r--kms++/src/extframebuffer.cpp6
-rw-r--r--kms++/src/framebuffer.cpp6
-rw-r--r--kms++/src/helpers.cpp6
-rw-r--r--kms++/src/helpers.h2
-rw-r--r--kms++/src/mode_cvt.cpp50
-rw-r--r--kms++/src/modedb.cpp3
-rw-r--r--kms++/src/modedb_cea.cpp511
-rw-r--r--kms++/src/modedb_dmt.cpp19
-rw-r--r--kms++/src/omap/omapcard.cpp3
-rw-r--r--kms++/src/omap/omapframebuffer.cpp33
-rw-r--r--kms++/src/pixelformats.cpp292
-rw-r--r--kms++/src/plane.cpp13
-rw-r--r--kms++/src/property.cpp6
-rw-r--r--kms++/src/videomode.cpp5
24 files changed, 738 insertions, 448 deletions
diff --git a/kms++/src/atomicreq.cpp b/kms++/src/atomicreq.cpp
index 28128f2..e01d7c2 100644
--- a/kms++/src/atomicreq.cpp
+++ b/kms++/src/atomicreq.cpp
@@ -14,10 +14,21 @@
struct _drmModeAtomicReq;
typedef struct _drmModeAtomicReq* drmModeAtomicReqPtr;
-static inline drmModeAtomicReqPtr drmModeAtomicAlloc() { return 0; }
-static inline void drmModeAtomicFree(drmModeAtomicReqPtr) { }
-static inline int drmModeAtomicAddProperty(drmModeAtomicReqPtr, uint32_t, uint32_t, uint64_t) { return 0; }
-static inline int drmModeAtomicCommit(int, drmModeAtomicReqPtr, int, void*) { return 0; }
+static inline drmModeAtomicReqPtr drmModeAtomicAlloc()
+{
+ return 0;
+}
+static inline void drmModeAtomicFree(drmModeAtomicReqPtr)
+{
+}
+static inline int drmModeAtomicAddProperty(drmModeAtomicReqPtr, uint32_t, uint32_t, uint64_t)
+{
+ return 0;
+}
+static inline int drmModeAtomicCommit(int, drmModeAtomicReqPtr, int, void*)
+{
+ return 0;
+}
#endif // DRM_CLIENT_CAP_ATOMIC
@@ -44,7 +55,7 @@ void AtomicReq::add(uint32_t ob_id, uint32_t prop_id, uint64_t value)
throw std::invalid_argument("foo");
}
-void AtomicReq::add(DrmPropObject* ob, Property *prop, uint64_t value)
+void AtomicReq::add(DrmPropObject* ob, Property* prop, uint64_t value)
{
add(ob->id(), prop->id(), value);
}
@@ -56,33 +67,33 @@ void AtomicReq::add(kms::DrmPropObject* ob, const string& prop, uint64_t value)
void AtomicReq::add(kms::DrmPropObject* ob, const map<string, uint64_t>& values)
{
- for(const auto& kvp : values)
+ for (const auto& kvp : values)
add(ob, kvp.first, kvp.second);
}
void AtomicReq::add_display(Connector* conn, Crtc* crtc, Blob* videomode, Plane* primary, Framebuffer* fb)
{
add(conn, {
- { "CRTC_ID", crtc->id() },
- });
+ { "CRTC_ID", crtc->id() },
+ });
add(crtc, {
- { "ACTIVE", 1 },
- { "MODE_ID", videomode->id() },
- });
+ { "ACTIVE", 1 },
+ { "MODE_ID", videomode->id() },
+ });
add(primary, {
- { "FB_ID", fb->id() },
- { "CRTC_ID", crtc->id() },
- { "SRC_X", 0 << 16 },
- { "SRC_Y", 0 << 16 },
- { "SRC_W", fb->width() << 16 },
- { "SRC_H", fb->height() << 16 },
- { "CRTC_X", 0 },
- { "CRTC_Y", 0 },
- { "CRTC_W", fb->width() },
- { "CRTC_H", fb->height() },
- });
+ { "FB_ID", fb->id() },
+ { "CRTC_ID", crtc->id() },
+ { "SRC_X", 0 << 16 },
+ { "SRC_Y", 0 << 16 },
+ { "SRC_W", fb->width() << 16 },
+ { "SRC_H", fb->height() << 16 },
+ { "CRTC_X", 0 },
+ { "CRTC_Y", 0 },
+ { "CRTC_W", fb->width() },
+ { "CRTC_H", fb->height() },
+ });
}
int AtomicReq::test(bool allow_modeset)
@@ -114,4 +125,4 @@ int AtomicReq::commit_sync(bool allow_modeset)
return drmModeAtomicCommit(m_card.fd(), m_req, flags, 0);
}
-}
+} // namespace kms
diff --git a/kms++/src/blob.cpp b/kms++/src/blob.cpp
index e1cd1f8..431863a 100644
--- a/kms++/src/blob.cpp
+++ b/kms++/src/blob.cpp
@@ -7,7 +7,6 @@ using namespace std;
namespace kms
{
-
Blob::Blob(Card& card, uint32_t blob_id)
: DrmObject(card, blob_id, DRM_MODE_OBJECT_BLOB), m_created(false)
{
@@ -48,4 +47,4 @@ vector<uint8_t> Blob::data()
return v;
}
-}
+} // namespace kms
diff --git a/kms++/src/card.cpp b/kms++/src/card.cpp
index 3a7ab70..935969d 100644
--- a/kms++/src/card.cpp
+++ b/kms++/src/card.cpp
@@ -22,20 +22,19 @@ using namespace std;
namespace kms
{
-
static vector<string> glob(const string& pattern)
{
glob_t glob_result;
memset(&glob_result, 0, sizeof(glob_result));
int r = glob(pattern.c_str(), 0, NULL, &glob_result);
- if(r != 0) {
+ if (r != 0) {
globfree(&glob_result);
throw runtime_error("failed to find DRM cards");
}
vector<string> filenames;
- for(size_t i = 0; i < glob_result.gl_pathc; ++i)
+ for (size_t i = 0; i < glob_result.gl_pathc; ++i)
filenames.push_back(string(glob_result.gl_pathv[i]));
globfree(&glob_result);
@@ -315,7 +314,7 @@ void Card::restore_modes()
Connector* Card::get_first_connected_connector() const
{
- for(auto c : m_connectors) {
+ for (auto c : m_connectors) {
if (c->connected())
return c;
}
@@ -334,23 +333,37 @@ DrmObject* Card::get_object(uint32_t id) const
std::vector<kms::DrmObject*> Card::get_objects() const
{
vector<DrmObject*> v;
- for(auto pair : m_obmap)
+ for (auto pair : m_obmap)
v.push_back(pair.second);
return v;
}
-Connector* Card::get_connector(uint32_t id) const { return dynamic_cast<Connector*>(get_object(id)); }
-Crtc* Card::get_crtc(uint32_t id) const { return dynamic_cast<Crtc*>(get_object(id)); }
-Encoder* Card::get_encoder(uint32_t id) const { return dynamic_cast<Encoder*>(get_object(id)); }
-Property* Card::get_prop(uint32_t id) const { return dynamic_cast<Property*>(get_object(id)); }
-Plane* Card::get_plane(uint32_t id) const { return dynamic_cast<Plane*>(get_object(id)); }
+Connector* Card::get_connector(uint32_t id) const
+{
+ return dynamic_cast<Connector*>(get_object(id));
+}
+Crtc* Card::get_crtc(uint32_t id) const
+{
+ return dynamic_cast<Crtc*>(get_object(id));
+}
+Encoder* Card::get_encoder(uint32_t id) const
+{
+ return dynamic_cast<Encoder*>(get_object(id));
+}
+Property* Card::get_prop(uint32_t id) const
+{
+ return dynamic_cast<Property*>(get_object(id));
+}
+Plane* Card::get_plane(uint32_t id) const
+{
+ return dynamic_cast<Plane*>(get_object(id));
+}
std::vector<kms::Pipeline> Card::get_connected_pipelines()
{
vector<Pipeline> outputs;
- for (auto conn : get_connectors())
- {
+ for (auto conn : get_connectors()) {
if (conn->connected() == false)
continue;
@@ -370,7 +383,7 @@ std::vector<kms::Pipeline> Card::get_connected_pipelines()
to_string(conn->idx()) +
" has no possible crtcs");
- outputs.push_back(Pipeline { crtc, conn });
+ outputs.push_back(Pipeline{ crtc, conn });
}
return outputs;
@@ -378,7 +391,7 @@ std::vector<kms::Pipeline> Card::get_connected_pipelines()
static void page_flip_handler(int fd, unsigned int frame,
unsigned int sec, unsigned int usec,
- void *data)
+ void* data)
{
auto handler = (PageFlipHandlerBase*)data;
double time = sec + usec / 1000000.0;
@@ -387,7 +400,7 @@ static void page_flip_handler(int fd, unsigned int frame,
void Card::call_page_flip_handlers()
{
- drmEventContext ev { };
+ drmEventContext ev{};
ev.version = DRM_EVENT_CONTEXT_VERSION;
ev.page_flip_handler = page_flip_handler;
@@ -400,18 +413,18 @@ int Card::disable_all()
for (Crtc* c : m_crtcs) {
req.add(c, {
- { "ACTIVE", 0 },
- });
+ { "ACTIVE", 0 },
+ });
}
for (Plane* p : m_planes) {
req.add(p, {
- { "FB_ID", 0 },
- { "CRTC_ID", 0 },
- });
+ { "FB_ID", 0 },
+ { "CRTC_ID", 0 },
+ });
}
return req.commit_sync(true);
}
-}
+} // namespace kms
diff --git a/kms++/src/connector.cpp b/kms++/src/connector.cpp
index a408619..92bab80 100644
--- a/kms++/src/connector.cpp
+++ b/kms++/src/connector.cpp
@@ -12,7 +12,6 @@ using namespace std;
namespace kms
{
-
#ifndef DRM_MODE_CONNECTOR_DPI
#define DRM_MODE_CONNECTOR_DPI 17
#endif
@@ -46,7 +45,10 @@ static const map<int, string> connection_str = {
};
static const map<int, string> subpix_str = {
-#define DEF_SUBPIX(c) { DRM_MODE_SUBPIXEL_##c, #c }
+#define DEF_SUBPIX(c) \
+ { \
+ DRM_MODE_SUBPIXEL_##c, #c \
+ }
DEF_SUBPIX(UNKNOWN),
DEF_SUBPIX(HORIZONTAL_RGB),
DEF_SUBPIX(HORIZONTAL_BGR),
@@ -56,13 +58,12 @@ static const map<int, string> subpix_str = {
#undef DEF_SUBPIX
};
-struct ConnectorPriv
-{
+struct ConnectorPriv {
drmModeConnectorPtr drm_connector;
};
-Connector::Connector(Card &card, uint32_t id, uint32_t idx)
- :DrmPropObject(card, id, DRM_MODE_OBJECT_CONNECTOR, idx)
+Connector::Connector(Card& card, uint32_t id, uint32_t idx)
+ : DrmPropObject(card, id, DRM_MODE_OBJECT_CONNECTOR, idx)
{
m_priv = new ConnectorPriv();
@@ -193,7 +194,7 @@ Videomode Connector::get_mode(unsigned xres, unsigned yres, float vrefresh, bool
bool Connector::connected() const
{
return m_priv->drm_connector->connection == DRM_MODE_CONNECTED ||
- m_priv->drm_connector->connection == DRM_MODE_UNKNOWNCONNECTION;
+ m_priv->drm_connector->connection == DRM_MODE_UNKNOWNCONNECTION;
}
ConnectorStatus Connector::connector_status() const
@@ -267,7 +268,7 @@ std::vector<Videomode> Connector::get_modes() const
for (int i = 0; i < m_priv->drm_connector->count_modes; i++)
modes.push_back(drm_mode_to_video_mode(
- m_priv->drm_connector->modes[i]));
+ m_priv->drm_connector->modes[i]));
return modes;
}
@@ -283,4 +284,4 @@ std::vector<Encoder*> Connector::get_encoders() const
return encoders;
}
-}
+} // namespace kms
diff --git a/kms++/src/crtc.cpp b/kms++/src/crtc.cpp
index 7ffaaff..6dc4333 100644
--- a/kms++/src/crtc.cpp
+++ b/kms++/src/crtc.cpp
@@ -11,14 +11,12 @@ using namespace std;
namespace kms
{
-
-struct CrtcPriv
-{
+struct CrtcPriv {
drmModeCrtcPtr drm_crtc;
};
-Crtc::Crtc(Card &card, uint32_t id, uint32_t idx)
- :DrmPropObject(card, id, DRM_MODE_OBJECT_CRTC, idx)
+Crtc::Crtc(Card& card, uint32_t id, uint32_t idx)
+ : DrmPropObject(card, id, DRM_MODE_OBJECT_CRTC, idx)
{
m_priv = new CrtcPriv();
m_priv->drm_crtc = drmModeGetCrtc(this->card().fd(), this->id());
@@ -65,13 +63,13 @@ int Crtc::set_mode(Connector* conn, const Videomode& mode)
unique_ptr<Blob> blob = mode.to_blob(card());
req.add(conn, {
- { "CRTC_ID", this->id() },
- });
+ { "CRTC_ID", this->id() },
+ });
req.add(this, {
- { "ACTIVE", 1 },
- { "MODE_ID", blob->id() },
- });
+ { "ACTIVE", 1 },
+ { "MODE_ID", blob->id() },
+ });
int r = req.commit_sync(true);
@@ -117,7 +115,7 @@ int Crtc::disable_plane(Plane* plane)
Plane* Crtc::get_primary_plane()
{
- Plane *primary = nullptr;
+ Plane* primary = nullptr;
for (Plane* p : get_possible_planes()) {
if (p->plane_type() != PlaneType::Primary)
@@ -135,7 +133,7 @@ Plane* Crtc::get_primary_plane()
throw invalid_argument(string("No primary plane for crtc ") + to_string(id()));
}
-int Crtc::page_flip(Framebuffer& fb, void *data)
+int Crtc::page_flip(Framebuffer& fb, void* data)
{
return drmModePageFlip(card().fd(), id(), fb.id(), DRM_MODE_PAGE_FLIP_EVENT, data);
}
@@ -180,4 +178,4 @@ int Crtc::gamma_size() const
return m_priv->drm_crtc->gamma_size;
}
-}
+} // namespace kms
diff --git a/kms++/src/dmabufframebuffer.cpp b/kms++/src/dmabufframebuffer.cpp
index 991d96c..cb76f09 100644
--- a/kms++/src/dmabufframebuffer.cpp
+++ b/kms++/src/dmabufframebuffer.cpp
@@ -62,8 +62,7 @@ DmabufFramebuffer::DmabufFramebuffer(Card& card, uint32_t width, uint32_t height
bo_handles, pitches.data(), offsets.data(), &id, 0);
if (r)
throw invalid_argument(string("drmModeAddFB2 failed: ") + strerror(errno));
- }
- else {
+ } else {
modifiers.resize(4);
r = drmModeAddFB2WithModifiers(card.fd(), width, height, (uint32_t)format,
bo_handles, pitches.data(), offsets.data(), modifiers.data(), &id, DRM_MODE_FB_MODIFIERS);
@@ -86,8 +85,8 @@ uint8_t* DmabufFramebuffer::map(unsigned plane)
if (p.map)
return p.map;
- p.map = (uint8_t *)mmap(0, p.size, PROT_READ | PROT_WRITE, MAP_SHARED,
- p.prime_fd, 0);
+ p.map = (uint8_t*)mmap(0, p.size, PROT_READ | PROT_WRITE, MAP_SHARED,
+ p.prime_fd, 0);
if (p.map == MAP_FAILED)
throw invalid_argument(string("mmap failed: ") + strerror(errno));
@@ -118,7 +117,7 @@ void DmabufFramebuffer::begin_cpu_access(CpuAccess access)
break;
}
- dma_buf_sync dbs {
+ dma_buf_sync dbs{
.flags = DMA_BUF_SYNC_START | m_sync_flags
};
@@ -134,7 +133,7 @@ void DmabufFramebuffer::end_cpu_access()
if (m_sync_flags == 0)
throw runtime_error("begin_cpu sync not started");
- dma_buf_sync dbs {
+ dma_buf_sync dbs{
.flags = DMA_BUF_SYNC_END | m_sync_flags
};
@@ -147,4 +146,4 @@ void DmabufFramebuffer::end_cpu_access()
m_sync_flags = 0;
}
-}
+} // namespace kms
diff --git a/kms++/src/drmobject.cpp b/kms++/src/drmobject.cpp
index 9c0f5ae..f01c8af 100644
--- a/kms++/src/drmobject.cpp
+++ b/kms++/src/drmobject.cpp
@@ -11,24 +11,22 @@ using namespace std;
namespace kms
{
-
DrmObject::DrmObject(Card& card, uint32_t object_type)
- :m_card(card), m_id(-1), m_object_type(object_type), m_idx(0)
+ : m_card(card), m_id(-1), m_object_type(object_type), m_idx(0)
{
}
DrmObject::DrmObject(Card& card, uint32_t id, uint32_t object_type, uint32_t idx)
- :m_card(card), m_id(id), m_object_type(object_type), m_idx(idx)
+ : m_card(card), m_id(id), m_object_type(object_type), m_idx(idx)
{
}
DrmObject::~DrmObject()
{
-
}
void DrmObject::set_id(uint32_t id)
{
m_id = id;
}
-}
+} // namespace kms
diff --git a/kms++/src/drmpropobject.cpp b/kms++/src/drmpropobject.cpp
index c78f70a..616aef7 100644
--- a/kms++/src/drmpropobject.cpp
+++ b/kms++/src/drmpropobject.cpp
@@ -11,7 +11,6 @@ using namespace std;
namespace kms
{
-
DrmPropObject::DrmPropObject(Card& card, uint32_t object_type)
: DrmObject(card, object_type)
{
@@ -25,7 +24,6 @@ DrmPropObject::DrmPropObject(Card& card, uint32_t id, uint32_t object_type, uint
DrmPropObject::~DrmPropObject()
{
-
}
void DrmPropObject::refresh_props()
@@ -90,7 +88,7 @@ int DrmPropObject::set_prop_value(uint32_t id, uint64_t value)
return drmModeObjectSetProperty(card().fd(), this->id(), this->object_type(), id, value);
}
-int DrmPropObject::set_prop_value(const string &name, uint64_t value)
+int DrmPropObject::set_prop_value(const string& name, uint64_t value)
{
Property* prop = get_prop(name);
@@ -100,4 +98,4 @@ int DrmPropObject::set_prop_value(const string &name, uint64_t value)
return set_prop_value(prop->id(), value);
}
-}
+} // namespace kms
diff --git a/kms++/src/dumbframebuffer.cpp b/kms++/src/dumbframebuffer.cpp
index 4c3c031..fc50586 100644
--- a/kms++/src/dumbframebuffer.cpp
+++ b/kms++/src/dumbframebuffer.cpp
@@ -19,14 +19,13 @@ using namespace std;
namespace kms
{
-
-DumbFramebuffer::DumbFramebuffer(Card &card, uint32_t width, uint32_t height, const string& fourcc)
- :DumbFramebuffer(card, width, height, FourCCToPixelFormat(fourcc))
+DumbFramebuffer::DumbFramebuffer(Card& card, uint32_t width, uint32_t height, const string& fourcc)
+ : DumbFramebuffer(card, width, height, FourCCToPixelFormat(fourcc))
{
}
DumbFramebuffer::DumbFramebuffer(Card& card, uint32_t width, uint32_t height, PixelFormat format)
- :Framebuffer(card, width, height), m_format(format)
+ : Framebuffer(card, width, height), m_format(format)
{
int r;
@@ -65,16 +64,22 @@ DumbFramebuffer::DumbFramebuffer(Card& card, uint32_t width, uint32_t height, Pi
/* create framebuffer object for the dumb-buffer */
uint32_t bo_handles[4] = {
- m_planes[0].handle, m_planes[1].handle,
- m_planes[2].handle, m_planes[3].handle,
+ m_planes[0].handle,
+ m_planes[1].handle,
+ m_planes[2].handle,
+ m_planes[3].handle,
};
uint32_t pitches[4] = {
- m_planes[0].stride, m_planes[1].stride,
- m_planes[2].stride, m_planes[3].stride,
+ m_planes[0].stride,
+ m_planes[1].stride,
+ m_planes[2].stride,
+ m_planes[3].stride,
};
uint32_t offsets[4] = {
- m_planes[0].offset, m_planes[1].offset,
- m_planes[2].offset, m_planes[3].offset,
+ m_planes[0].offset,
+ m_planes[1].offset,
+ m_planes[2].offset,
+ m_planes[3].offset,
};
uint32_t id;
r = drmModeAddFB2(card.fd(), width, height, (uint32_t)format,
@@ -121,8 +126,8 @@ uint8_t* DumbFramebuffer::map(unsigned plane)
throw invalid_argument(string("DRM_IOCTL_MODE_MAP_DUMB failed: ") + strerror(errno));
/* perform actual memory mapping */
- p.map = (uint8_t *)mmap(0, p.size, PROT_READ | PROT_WRITE, MAP_SHARED,
- card().fd(), mreq.offset);
+ p.map = (uint8_t*)mmap(0, p.size, PROT_READ | PROT_WRITE, MAP_SHARED,
+ card().fd(), mreq.offset);
if (p.map == MAP_FAILED)
throw invalid_argument(string("mmap failed: ") + strerror(errno));
@@ -142,4 +147,4 @@ int DumbFramebuffer::prime_fd(unsigned int plane)
return m_planes.at(plane).prime_fd;
}
-}
+} // namespace kms
diff --git a/kms++/src/encoder.cpp b/kms++/src/encoder.cpp
index 30a241a..8144b9f 100644
--- a/kms++/src/encoder.cpp
+++ b/kms++/src/encoder.cpp
@@ -12,14 +12,15 @@ using namespace std;
namespace kms
{
-
-struct EncoderPriv
-{
+struct EncoderPriv {
drmModeEncoderPtr drm_encoder;
};
static const map<int, string> encoder_types = {
-#define DEF_ENC(c) { DRM_MODE_ENCODER_##c, #c }
+#define DEF_ENC(c) \
+ { \
+ DRM_MODE_ENCODER_##c, #c \
+ }
DEF_ENC(NONE),
DEF_ENC(DAC),
DEF_ENC(TMDS),
@@ -32,8 +33,8 @@ static const map<int, string> encoder_types = {
#undef DEF_ENC
};
-Encoder::Encoder(Card &card, uint32_t id, uint32_t idx)
- :DrmPropObject(card, id, DRM_MODE_OBJECT_ENCODER, idx)
+Encoder::Encoder(Card& card, uint32_t id, uint32_t idx)
+ : DrmPropObject(card, id, DRM_MODE_OBJECT_ENCODER, idx)
{
m_priv = new EncoderPriv();
m_priv->drm_encoder = drmModeGetEncoder(this->card().fd(), this->id());
@@ -83,4 +84,4 @@ const string& Encoder::get_encoder_type() const
return encoder_types.at(m_priv->drm_encoder->encoder_type);
}
-}
+} // namespace kms
diff --git a/kms++/src/extframebuffer.cpp b/kms++/src/extframebuffer.cpp
index 4ea563c..78b6fbb 100644
--- a/kms++/src/extframebuffer.cpp
+++ b/kms++/src/extframebuffer.cpp
@@ -13,7 +13,6 @@ using namespace std;
namespace kms
{
-
ExtFramebuffer::ExtFramebuffer(Card& card, uint32_t width, uint32_t height, PixelFormat format,
vector<uint32_t> handles, vector<uint32_t> pitches, vector<uint32_t> offsets, vector<uint64_t> modifiers)
: Framebuffer(card, width, height)
@@ -46,8 +45,7 @@ ExtFramebuffer::ExtFramebuffer(Card& card, uint32_t width, uint32_t height, Pixe
if (modifiers.empty()) {
r = drmModeAddFB2(card.fd(), width, height, (uint32_t)format, handles.data(), pitches.data(), offsets.data(), &id, 0);
- }
- else {
+ } else {
modifiers.resize(4);
r = drmModeAddFB2WithModifiers(card.fd(), width, height, (uint32_t)format, handles.data(), pitches.data(), offsets.data(), modifiers.data(), &id, DRM_MODE_FB_MODIFIERS);
}
@@ -63,4 +61,4 @@ ExtFramebuffer::~ExtFramebuffer()
drmModeRmFB(card().fd(), id());
}
-}
+} // namespace kms
diff --git a/kms++/src/framebuffer.cpp b/kms++/src/framebuffer.cpp
index 39c4e16..f1cba3b 100644
--- a/kms++/src/framebuffer.cpp
+++ b/kms++/src/framebuffer.cpp
@@ -11,7 +11,6 @@ using namespace std;
namespace kms
{
-
Framebuffer::Framebuffer(Card& card, uint32_t width, uint32_t height)
: DrmObject(card, DRM_MODE_OBJECT_FB), m_width(width), m_height(height)
{
@@ -37,7 +36,7 @@ Framebuffer::Framebuffer(Card& card, uint32_t id)
void Framebuffer::flush()
{
- drmModeClip clip { };
+ drmModeClip clip{};
clip.x1 = clip.y1 = 0;
clip.x2 = width();
clip.y2 = height();
@@ -52,5 +51,4 @@ Framebuffer::~Framebuffer()
card().m_framebuffers.erase(iter);
}
-
-}
+} // namespace kms
diff --git a/kms++/src/helpers.cpp b/kms++/src/helpers.cpp
index 8bd082b..9079a23 100644
--- a/kms++/src/helpers.cpp
+++ b/kms++/src/helpers.cpp
@@ -9,7 +9,7 @@ namespace kms
{
Videomode drm_mode_to_video_mode(const drmModeModeInfo& drmmode)
{
- Videomode mode = { };
+ Videomode mode = {};
auto& src = drmmode;
auto& dst = mode;
@@ -40,7 +40,7 @@ Videomode drm_mode_to_video_mode(const drmModeModeInfo& drmmode)
drmModeModeInfo video_mode_to_drm_mode(const Videomode& mode)
{
- drmModeModeInfo drmmode = { };
+ drmModeModeInfo drmmode = {};
auto& src = mode;
auto& dst = drmmode;
@@ -69,4 +69,4 @@ drmModeModeInfo video_mode_to_drm_mode(const Videomode& mode)
return drmmode;
}
-}
+} // namespace kms
diff --git a/kms++/src/helpers.h b/kms++/src/helpers.h
index 4eb597c..58926bf 100644
--- a/kms++/src/helpers.h
+++ b/kms++/src/helpers.h
@@ -9,4 +9,4 @@ struct Videomode;
Videomode drm_mode_to_video_mode(const drmModeModeInfo& drmmode);
drmModeModeInfo video_mode_to_drm_mode(const Videomode& mode);
-}
+} // namespace kms
diff --git a/kms++/src/mode_cvt.cpp b/kms++/src/mode_cvt.cpp
index 41503c7..a7a10b8 100644
--- a/kms++/src/mode_cvt.cpp
+++ b/kms++/src/mode_cvt.cpp
@@ -7,12 +7,10 @@ using namespace std;
namespace kms
{
-
static float CELL_GRAN = 8;
static float CELL_GRAN_RND = round(CELL_GRAN);
-struct CVTConsts
-{
+struct CVTConsts {
float CLOCK_STEP;
float MIN_V_BPORCH;
float RB_H_BLANK;
@@ -24,30 +22,28 @@ struct CVTConsts
float REFRESH_MULTIPLIER;
};
-static const CVTConsts cvt_consts_v1 =
-{
- .CLOCK_STEP = 0.25, // Fixed
- .MIN_V_BPORCH = 6, // Min
- .RB_H_BLANK = 160, // Fixed
- .RB_H_FPORCH = 48, // Fixed
- .RB_H_SYNC = 32, // Fixed
- .RB_H_BPORCH = 80, // Fixed
- .RB_MIN_V_BLANK = 460, // Min
- .RB_V_FPORCH = 3, // Fixed
- .REFRESH_MULTIPLIER = 1,// Fixed
+static const CVTConsts cvt_consts_v1 = {
+ .CLOCK_STEP = 0.25, // Fixed
+ .MIN_V_BPORCH = 6, // Min
+ .RB_H_BLANK = 160, // Fixed
+ .RB_H_FPORCH = 48, // Fixed
+ .RB_H_SYNC = 32, // Fixed
+ .RB_H_BPORCH = 80, // Fixed
+ .RB_MIN_V_BLANK = 460, // Min
+ .RB_V_FPORCH = 3, // Fixed
+ .REFRESH_MULTIPLIER = 1, // Fixed
};
-static const CVTConsts cvt_consts_v2 =
-{
- .CLOCK_STEP = 0.001, // Fixed
- .MIN_V_BPORCH = 6, // Fixed
- .RB_H_BLANK = 80, // Fixed
- .RB_H_FPORCH = 8, // Fixed
- .RB_H_SYNC = 32, // Fixed
- .RB_H_BPORCH = 40, // Fixed
- .RB_MIN_V_BLANK = 460, // Min
- .RB_V_FPORCH = 1, // Min
- .REFRESH_MULTIPLIER = 1,// or 1000/1001
+static const CVTConsts cvt_consts_v2 = {
+ .CLOCK_STEP = 0.001, // Fixed
+ .MIN_V_BPORCH = 6, // Fixed
+ .RB_H_BLANK = 80, // Fixed
+ .RB_H_FPORCH = 8, // Fixed
+ .RB_H_SYNC = 32, // Fixed
+ .RB_H_BPORCH = 40, // Fixed
+ .RB_MIN_V_BLANK = 460, // Min
+ .RB_V_FPORCH = 1, // Min
+ .REFRESH_MULTIPLIER = 1, // or 1000/1001
};
Videomode videomode_from_cvt(uint32_t hact, uint32_t vact, uint32_t refresh, bool ilace, bool reduced_v2, bool video_optimized)
@@ -55,7 +51,7 @@ Videomode videomode_from_cvt(uint32_t hact, uint32_t vact, uint32_t refresh, boo
CVTConsts c = reduced_v2 ? cvt_consts_v2 : cvt_consts_v1;
if (video_optimized)
- c.REFRESH_MULTIPLIER = 1000.0/1001.0;
+ c.REFRESH_MULTIPLIER = 1000.0 / 1001.0;
bool INT_RQD = ilace;
@@ -151,4 +147,4 @@ Videomode videomode_from_cvt(uint32_t hact, uint32_t vact, uint32_t refresh, boo
return mode;
}
-}
+} // namespace kms
diff --git a/kms++/src/modedb.cpp b/kms++/src/modedb.cpp
index 5d5d373..081100a 100644
--- a/kms++/src/modedb.cpp
+++ b/kms++/src/modedb.cpp
@@ -8,7 +8,6 @@ using namespace std;
namespace kms
{
-
static const Videomode& find_from_table(const Videomode* modes, uint32_t width, uint32_t height, float vrefresh, bool ilace)
{
for (unsigned i = 0; modes[i].clock; ++i) {
@@ -56,4 +55,4 @@ const Videomode& find_cea(uint32_t width, uint32_t height, float vrefresh, bool
return find_from_table(cea_modes, width, height, vrefresh, ilace);
}
-}
+} // namespace kms
diff --git a/kms++/src/modedb_cea.cpp b/kms++/src/modedb_cea.cpp
index a99a612..b09472f 100644
--- a/kms++/src/modedb_cea.cpp
+++ b/kms++/src/modedb_cea.cpp
@@ -35,14 +35,13 @@
namespace kms
{
-
#define DIV_ROUND(n, d) (((n) + (d) / 2) / (d))
-#define DRM_MODE(nm, c, hd, hss, hse, ht, hsk, vd, vss, vse, vt, vs, f) \
- .name = nm, .clock = (c), \
+#define DRM_MODE(nm, c, hd, hss, hse, ht, hsk, vd, vss, vse, vt, vs, f) \
+ .name = nm, .clock = (c), \
.hdisplay = (hd), .hsync_start = (hss), .hsync_end = (hse), .htotal = (ht), .hskew = (hsk), \
- .vdisplay = (vd), .vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), .vscan = (vs), \
- .vrefresh = DIV_ROUND(c * 1000, ht * vt) * (((f) & DRM_MODE_FLAG_INTERLACE) ? 2 : 1), \
+ .vdisplay = (vd), .vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), .vscan = (vs), \
+ .vrefresh = DIV_ROUND(c * 1000, ht * vt) * (((f)&DRM_MODE_FLAG_INTERLACE) ? 2 : 1), \
.flags = (f), .type = 0
/*
@@ -51,352 +50,416 @@ namespace kms
*/
const Videomode cea_modes[] = {
/* 1 - 640x480@60Hz */
- { DRM_MODE("640x480", 25175, 640, 656,
- 752, 800, 0, 480, 490, 492, 525, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
+ {
+ DRM_MODE("640x480", 25175, 640, 656,
+ 752, 800, 0, 480, 490, 492, 525, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
},
/* 2 - 720x480@60Hz */
- { DRM_MODE("720x480", 27000, 720, 736,
- 798, 858, 0, 480, 489, 495, 525, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
+ {
+ DRM_MODE("720x480", 27000, 720, 736,
+ 798, 858, 0, 480, 489, 495, 525, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
},
/* 3 - 720x480@60Hz */
- { DRM_MODE("720x480", 27000, 720, 736,
- 798, 858, 0, 480, 489, 495, 525, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
+ {
+ DRM_MODE("720x480", 27000, 720, 736,
+ 798, 858, 0, 480, 489, 495, 525, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
},
/* 4 - 1280x720@60Hz */
- { DRM_MODE("1280x720", 74250, 1280, 1390,
- 1430, 1650, 0, 720, 725, 730, 750, 0,
- DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+ {
+ DRM_MODE("1280x720", 74250, 1280, 1390,
+ 1430, 1650, 0, 720, 725, 730, 750, 0,
+ DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
},
/* 5 - 1920x1080i@60Hz */
- { DRM_MODE("1920x1080i", 74250, 1920, 2008,
- 2052, 2200, 0, 1080, 1084, 1094, 1125, 0,
- DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
- DRM_MODE_FLAG_INTERLACE),
+ {
+ DRM_MODE("1920x1080i", 74250, 1920, 2008,
+ 2052, 2200, 0, 1080, 1084, 1094, 1125, 0,
+ DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
+ DRM_MODE_FLAG_INTERLACE),
},
/* 6 - 720(1440)x480i@60Hz */
- { DRM_MODE("720x480i", 13500, 720, 739,
- 801, 858, 0, 480, 488, 494, 525, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
- DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK),
+ {
+ DRM_MODE("720x480i", 13500, 720, 739,
+ 801, 858, 0, 480, 488, 494, 525, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
+ DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK),
},
/* 7 - 720(1440)x480i@60Hz */
- { DRM_MODE("720x480i", 13500, 720, 739,
- 801, 858, 0, 480, 488, 494, 525, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
- DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK),
+ {
+ DRM_MODE("720x480i", 13500, 720, 739,
+ 801, 858, 0, 480, 488, 494, 525, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
+ DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK),
},
/* 8 - 720(1440)x240@60Hz */
- { DRM_MODE("720x240", 13500, 720, 739,
- 801, 858, 0, 240, 244, 247, 262, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
- DRM_MODE_FLAG_DBLCLK),
+ {
+ DRM_MODE("720x240", 13500, 720, 739,
+ 801, 858, 0, 240, 244, 247, 262, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
+ DRM_MODE_FLAG_DBLCLK),
},
/* 9 - 720(1440)x240@60Hz */
- { DRM_MODE("720x240", 13500, 720, 739,
- 801, 858, 0, 240, 244, 247, 262, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
- DRM_MODE_FLAG_DBLCLK),
+ {
+ DRM_MODE("720x240", 13500, 720, 739,
+ 801, 858, 0, 240, 244, 247, 262, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
+ DRM_MODE_FLAG_DBLCLK),
},
/* 10 - 2880x480i@60Hz */
- { DRM_MODE("2880x480i", 54000, 2880, 2956,
- 3204, 3432, 0, 480, 488, 494, 525, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
- DRM_MODE_FLAG_INTERLACE),
+ {
+ DRM_MODE("2880x480i", 54000, 2880, 2956,
+ 3204, 3432, 0, 480, 488, 494, 525, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
+ DRM_MODE_FLAG_INTERLACE),
},
/* 11 - 2880x480i@60Hz */
- { DRM_MODE("2880x480i", 54000, 2880, 2956,
- 3204, 3432, 0, 480, 488, 494, 525, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
- DRM_MODE_FLAG_INTERLACE),
+ {
+ DRM_MODE("2880x480i", 54000, 2880, 2956,
+ 3204, 3432, 0, 480, 488, 494, 525, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
+ DRM_MODE_FLAG_INTERLACE),
},
/* 12 - 2880x240@60Hz */
- { DRM_MODE("2880x240", 54000, 2880, 2956,
- 3204, 3432, 0, 240, 244, 247, 262, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
+ {
+ DRM_MODE("2880x240", 54000, 2880, 2956,
+ 3204, 3432, 0, 240, 244, 247, 262, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
},
/* 13 - 2880x240@60Hz */
- { DRM_MODE("2880x240", 54000, 2880, 2956,
- 3204, 3432, 0, 240, 244, 247, 262, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
+ {
+ DRM_MODE("2880x240", 54000, 2880, 2956,
+ 3204, 3432, 0, 240, 244, 247, 262, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
},
/* 14 - 1440x480@60Hz */
- { DRM_MODE("1440x480", 54000, 1440, 1472,
- 1596, 1716, 0, 480, 489, 495, 525, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
+ {
+ DRM_MODE("1440x480", 54000, 1440, 1472,
+ 1596, 1716, 0, 480, 489, 495, 525, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
},
/* 15 - 1440x480@60Hz */
- { DRM_MODE("1440x480", 54000, 1440, 1472,
- 1596, 1716, 0, 480, 489, 495, 525, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
+ {
+ DRM_MODE("1440x480", 54000, 1440, 1472,
+ 1596, 1716, 0, 480, 489, 495, 525, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
},
/* 16 - 1920x1080@60Hz */
- { DRM_MODE("1920x1080", 148500, 1920, 2008,
- 2052, 2200, 0, 1080, 1084, 1089, 1125, 0,
- DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+ {
+ DRM_MODE("1920x1080", 148500, 1920, 2008,
+ 2052, 2200, 0, 1080, 1084, 1089, 1125, 0,
+ DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
},
/* 17 - 720x576@50Hz */
- { DRM_MODE("720x576", 27000, 720, 732,
- 796, 864, 0, 576, 581, 586, 625, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
+ {
+ DRM_MODE("720x576", 27000, 720, 732,
+ 796, 864, 0, 576, 581, 586, 625, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
},
/* 18 - 720x576@50Hz */
- { DRM_MODE("720x576", 27000, 720, 732,
- 796, 864, 0, 576, 581, 586, 625, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
+ {
+ DRM_MODE("720x576", 27000, 720, 732,
+ 796, 864, 0, 576, 581, 586, 625, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
},
/* 19 - 1280x720@50Hz */
- { DRM_MODE("1280x720", 74250, 1280, 1720,
- 1760, 1980, 0, 720, 725, 730, 750, 0,
- DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+ {
+ DRM_MODE("1280x720", 74250, 1280, 1720,
+ 1760, 1980, 0, 720, 725, 730, 750, 0,
+ DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
},
/* 20 - 1920x1080i@50Hz */
- { DRM_MODE("1920x1080i", 74250, 1920, 2448,
- 2492, 2640, 0, 1080, 1084, 1094, 1125, 0,
- DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
- DRM_MODE_FLAG_INTERLACE),
+ {
+ DRM_MODE("1920x1080i", 74250, 1920, 2448,
+ 2492, 2640, 0, 1080, 1084, 1094, 1125, 0,
+ DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
+ DRM_MODE_FLAG_INTERLACE),
},
/* 21 - 720(1440)x576i@50Hz */
- { DRM_MODE("720x576i", 13500, 720, 732,
- 795, 864, 0, 576, 580, 586, 625, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
- DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK),
+ {
+ DRM_MODE("720x576i", 13500, 720, 732,
+ 795, 864, 0, 576, 580, 586, 625, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
+ DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK),
},
/* 22 - 720(1440)x576i@50Hz */
- { DRM_MODE("720x576i", 13500, 720, 732,
- 795, 864, 0, 576, 580, 586, 625, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
- DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK),
+ {
+ DRM_MODE("720x576i", 13500, 720, 732,
+ 795, 864, 0, 576, 580, 586, 625, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
+ DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK),
},
/* 23 - 720(1440)x288@50Hz */
- { DRM_MODE("720x288", 13500, 720, 732,
- 795, 864, 0, 288, 290, 293, 312, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
- DRM_MODE_FLAG_DBLCLK),
+ {
+ DRM_MODE("720x288", 13500, 720, 732,
+ 795, 864, 0, 288, 290, 293, 312, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
+ DRM_MODE_FLAG_DBLCLK),
},
/* 24 - 720(1440)x288@50Hz */
- { DRM_MODE("720x288", 13500, 720, 732,
- 795, 864, 0, 288, 290, 293, 312, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
- DRM_MODE_FLAG_DBLCLK),
+ {
+ DRM_MODE("720x288", 13500, 720, 732,
+ 795, 864, 0, 288, 290, 293, 312, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
+ DRM_MODE_FLAG_DBLCLK),
},
/* 25 - 2880x576i@50Hz */
- { DRM_MODE("2880x576i", 54000, 2880, 2928,
- 3180, 3456, 0, 576, 580, 586, 625, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
- DRM_MODE_FLAG_INTERLACE),
+ {
+ DRM_MODE("2880x576i", 54000, 2880, 2928,
+ 3180, 3456, 0, 576, 580, 586, 625, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
+ DRM_MODE_FLAG_INTERLACE),
},
/* 26 - 2880x576i@50Hz */
- { DRM_MODE("2880x576i", 54000, 2880, 2928,
- 3180, 3456, 0, 576, 580, 586, 625, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
- DRM_MODE_FLAG_INTERLACE),
+ {
+ DRM_MODE("2880x576i", 54000, 2880, 2928,
+ 3180, 3456, 0, 576, 580, 586, 625, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
+ DRM_MODE_FLAG_INTERLACE),
},
/* 27 - 2880x288@50Hz */
- { DRM_MODE("2880x288", 54000, 2880, 2928,
- 3180, 3456, 0, 288, 290, 293, 312, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
+ {
+ DRM_MODE("2880x288", 54000, 2880, 2928,
+ 3180, 3456, 0, 288, 290, 293, 312, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
},
/* 28 - 2880x288@50Hz */
- { DRM_MODE("2880x288", 54000, 2880, 2928,
- 3180, 3456, 0, 288, 290, 293, 312, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
+ {
+ DRM_MODE("2880x288", 54000, 2880, 2928,
+ 3180, 3456, 0, 288, 290, 293, 312, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
},
/* 29 - 1440x576@50Hz */
- { DRM_MODE("1440x576", 54000, 1440, 1464,
- 1592, 1728, 0, 576, 581, 586, 625, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
+ {
+ DRM_MODE("1440x576", 54000, 1440, 1464,
+ 1592, 1728, 0, 576, 581, 586, 625, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
},
/* 30 - 1440x576@50Hz */
- { DRM_MODE("1440x576", 54000, 1440, 1464,
- 1592, 1728, 0, 576, 581, 586, 625, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
+ {
+ DRM_MODE("1440x576", 54000, 1440, 1464,
+ 1592, 1728, 0, 576, 581, 586, 625, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
},
/* 31 - 1920x1080@50Hz */
- { DRM_MODE("1920x1080", 148500, 1920, 2448,
- 2492, 2640, 0, 1080, 1084, 1089, 1125, 0,
- DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+ {
+ DRM_MODE("1920x1080", 148500, 1920, 2448,
+ 2492, 2640, 0, 1080, 1084, 1089, 1125, 0,
+ DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
},
/* 32 - 1920x1080@24Hz */
- { DRM_MODE("1920x1080", 74250, 1920, 2558,
- 2602, 2750, 0, 1080, 1084, 1089, 1125, 0,
- DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+ {
+ DRM_MODE("1920x1080", 74250, 1920, 2558,
+ 2602, 2750, 0, 1080, 1084, 1089, 1125, 0,
+ DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
},
/* 33 - 1920x1080@25Hz */
- { DRM_MODE("1920x1080", 74250, 1920, 2448,
- 2492, 2640, 0, 1080, 1084, 1089, 1125, 0,
- DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+ {
+ DRM_MODE("1920x1080", 74250, 1920, 2448,
+ 2492, 2640, 0, 1080, 1084, 1089, 1125, 0,
+ DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
},
/* 34 - 1920x1080@30Hz */
- { DRM_MODE("1920x1080", 74250, 1920, 2008,
- 2052, 2200, 0, 1080, 1084, 1089, 1125, 0,
- DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+ {
+ DRM_MODE("1920x1080", 74250, 1920, 2008,
+ 2052, 2200, 0, 1080, 1084, 1089, 1125, 0,
+ DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
},
/* 35 - 2880x480@60Hz */
- { DRM_MODE("2880x480", 108000, 2880, 2944,
- 3192, 3432, 0, 480, 489, 495, 525, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
+ {
+ DRM_MODE("2880x480", 108000, 2880, 2944,
+ 3192, 3432, 0, 480, 489, 495, 525, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
},
/* 36 - 2880x480@60Hz */
- { DRM_MODE("2880x480", 108000, 2880, 2944,
- 3192, 3432, 0, 480, 489, 495, 525, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
+ {
+ DRM_MODE("2880x480", 108000, 2880, 2944,
+ 3192, 3432, 0, 480, 489, 495, 525, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
},
/* 37 - 2880x576@50Hz */
- { DRM_MODE("2880x576", 108000, 2880, 2928,
- 3184, 3456, 0, 576, 581, 586, 625, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
+ {
+ DRM_MODE("2880x576", 108000, 2880, 2928,
+ 3184, 3456, 0, 576, 581, 586, 625, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
},
/* 38 - 2880x576@50Hz */
- { DRM_MODE("2880x576", 108000, 2880, 2928,
- 3184, 3456, 0, 576, 581, 586, 625, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
+ {
+ DRM_MODE("2880x576", 108000, 2880, 2928,
+ 3184, 3456, 0, 576, 581, 586, 625, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
},
/* 39 - 1920x1080i@50Hz */
- { DRM_MODE("1920x1080i", 72000, 1920, 1952,
- 2120, 2304, 0, 1080, 1126, 1136, 1250, 0,
- DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC |
- DRM_MODE_FLAG_INTERLACE),
+ {
+ DRM_MODE("1920x1080i", 72000, 1920, 1952,
+ 2120, 2304, 0, 1080, 1126, 1136, 1250, 0,
+ DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC |
+ DRM_MODE_FLAG_INTERLACE),
},
/* 40 - 1920x1080i@100Hz */
- { DRM_MODE("1920x1080i", 148500, 1920, 2448,
- 2492, 2640, 0, 1080, 1084, 1094, 1125, 0,
- DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
- DRM_MODE_FLAG_INTERLACE),
+ {
+ DRM_MODE("1920x1080i", 148500, 1920, 2448,
+ 2492, 2640, 0, 1080, 1084, 1094, 1125, 0,
+ DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
+ DRM_MODE_FLAG_INTERLACE),
},
/* 41 - 1280x720@100Hz */
- { DRM_MODE("1280x720", 148500, 1280, 1720,
- 1760, 1980, 0, 720, 725, 730, 750, 0,
- DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+ {
+ DRM_MODE("1280x720", 148500, 1280, 1720,
+ 1760, 1980, 0, 720, 725, 730, 750, 0,
+ DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
},
/* 42 - 720x576@100Hz */
- { DRM_MODE("720x576", 54000, 720, 732,
- 796, 864, 0, 576, 581, 586, 625, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
+ {
+ DRM_MODE("720x576", 54000, 720, 732,
+ 796, 864, 0, 576, 581, 586, 625, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
},
/* 43 - 720x576@100Hz */
- { DRM_MODE("720x576", 54000, 720, 732,
- 796, 864, 0, 576, 581, 586, 625, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
+ {
+ DRM_MODE("720x576", 54000, 720, 732,
+ 796, 864, 0, 576, 581, 586, 625, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
},
/* 44 - 720(1440)x576i@100Hz */
- { DRM_MODE("720x576i", 27000, 720, 732,
- 795, 864, 0, 576, 580, 586, 625, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
- DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK),
+ {
+ DRM_MODE("720x576i", 27000, 720, 732,
+ 795, 864, 0, 576, 580, 586, 625, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
+ DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK),
},
/* 45 - 720(1440)x576i@100Hz */
- { DRM_MODE("720x576i", 27000, 720, 732,
- 795, 864, 0, 576, 580, 586, 625, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
- DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK),
+ {
+ DRM_MODE("720x576i", 27000, 720, 732,
+ 795, 864, 0, 576, 580, 586, 625, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
+ DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK),
},
/* 46 - 1920x1080i@120Hz */
- { DRM_MODE("1920x1080i", 148500, 1920, 2008,
- 2052, 2200, 0, 1080, 1084, 1094, 1125, 0,
- DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
- DRM_MODE_FLAG_INTERLACE),
+ {
+ DRM_MODE("1920x1080i", 148500, 1920, 2008,
+ 2052, 2200, 0, 1080, 1084, 1094, 1125, 0,
+ DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
+ DRM_MODE_FLAG_INTERLACE),
},
/* 47 - 1280x720@120Hz */
- { DRM_MODE("1280x720", 148500, 1280, 1390,
- 1430, 1650, 0, 720, 725, 730, 750, 0,
- DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+ {
+ DRM_MODE("1280x720", 148500, 1280, 1390,
+ 1430, 1650, 0, 720, 725, 730, 750, 0,
+ DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
},
/* 48 - 720x480@120Hz */
- { DRM_MODE("720x480", 54000, 720, 736,
- 798, 858, 0, 480, 489, 495, 525, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
+ {
+ DRM_MODE("720x480", 54000, 720, 736,
+ 798, 858, 0, 480, 489, 495, 525, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
},
/* 49 - 720x480@120Hz */
- { DRM_MODE("720x480", 54000, 720, 736,
- 798, 858, 0, 480, 489, 495, 525, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
+ {
+ DRM_MODE("720x480", 54000, 720, 736,
+ 798, 858, 0, 480, 489, 495, 525, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
},
/* 50 - 720(1440)x480i@120Hz */
- { DRM_MODE("720x480i", 27000, 720, 739,
- 801, 858, 0, 480, 488, 494, 525, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
- DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK),
+ {
+ DRM_MODE("720x480i", 27000, 720, 739,
+ 801, 858, 0, 480, 488, 494, 525, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
+ DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK),
},
/* 51 - 720(1440)x480i@120Hz */
- { DRM_MODE("720x480i", 27000, 720, 739,
- 801, 858, 0, 480, 488, 494, 525, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
- DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK),
+ {
+ DRM_MODE("720x480i", 27000, 720, 739,
+ 801, 858, 0, 480, 488, 494, 525, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
+ DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK),
},
/* 52 - 720x576@200Hz */
- { DRM_MODE("720x576", 108000, 720, 732,
- 796, 864, 0, 576, 581, 586, 625, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
+ {
+ DRM_MODE("720x576", 108000, 720, 732,
+ 796, 864, 0, 576, 581, 586, 625, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
},
/* 53 - 720x576@200Hz */
- { DRM_MODE("720x576", 108000, 720, 732,
- 796, 864, 0, 576, 581, 586, 625, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
+ {
+ DRM_MODE("720x576", 108000, 720, 732,
+ 796, 864, 0, 576, 581, 586, 625, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
},
/* 54 - 720(1440)x576i@200Hz */
- { DRM_MODE("720x576i", 54000, 720, 732,
- 795, 864, 0, 576, 580, 586, 625, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
- DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK),
+ {
+ DRM_MODE("720x576i", 54000, 720, 732,
+ 795, 864, 0, 576, 580, 586, 625, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
+ DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK),
},
/* 55 - 720(1440)x576i@200Hz */
- { DRM_MODE("720x576i", 54000, 720, 732,
- 795, 864, 0, 576, 580, 586, 625, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
- DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK),
+ {
+ DRM_MODE("720x576i", 54000, 720, 732,
+ 795, 864, 0, 576, 580, 586, 625, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
+ DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK),
},
/* 56 - 720x480@240Hz */
- { DRM_MODE("720x480", 108000, 720, 736,
- 798, 858, 0, 480, 489, 495, 525, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
+ {
+ DRM_MODE("720x480", 108000, 720, 736,
+ 798, 858, 0, 480, 489, 495, 525, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
},
/* 57 - 720x480@240Hz */
- { DRM_MODE("720x480", 108000, 720, 736,
- 798, 858, 0, 480, 489, 495, 525, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
+ {
+ DRM_MODE("720x480", 108000, 720, 736,
+ 798, 858, 0, 480, 489, 495, 525, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
},
/* 58 - 720(1440)x480i@240 */
- { DRM_MODE("720x480i", 54000, 720, 739,
- 801, 858, 0, 480, 488, 494, 525, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
- DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK),
+ {
+ DRM_MODE("720x480i", 54000, 720, 739,
+ 801, 858, 0, 480, 488, 494, 525, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
+ DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK),
},
/* 59 - 720(1440)x480i@240 */
- { DRM_MODE("720x480i", 54000, 720, 739,
- 801, 858, 0, 480, 488, 494, 525, 0,
- DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
- DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK),
+ {
+ DRM_MODE("720x480i", 54000, 720, 739,
+ 801, 858, 0, 480, 488, 494, 525, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
+ DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK),
},
/* 60 - 1280x720@24Hz */
- { DRM_MODE("1280x720", 59400, 1280, 3040,
- 3080, 3300, 0, 720, 725, 730, 750, 0,
- DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+ {
+ DRM_MODE("1280x720", 59400, 1280, 3040,
+ 3080, 3300, 0, 720, 725, 730, 750, 0,
+ DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
},
/* 61 - 1280x720@25Hz */
- { DRM_MODE("1280x720", 74250, 1280, 3700,
- 3740, 3960, 0, 720, 725, 730, 750, 0,
- DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+ {
+ DRM_MODE("1280x720", 74250, 1280, 3700,
+ 3740, 3960, 0, 720, 725, 730, 750, 0,
+ DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
},
/* 62 - 1280x720@30Hz */
- { DRM_MODE("1280x720", 74250, 1280, 3040,
- 3080, 3300, 0, 720, 725, 730, 750, 0,
- DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+ {
+ DRM_MODE("1280x720", 74250, 1280, 3040,
+ 3080, 3300, 0, 720, 725, 730, 750, 0,
+ DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
},
/* 63 - 1920x1080@120Hz */
- { DRM_MODE("1920x1080", 297000, 1920, 2008,
- 2052, 2200, 0, 1080, 1084, 1089, 1125, 0,
- DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+ {
+ DRM_MODE("1920x1080", 297000, 1920, 2008,
+ 2052, 2200, 0, 1080, 1084, 1089, 1125, 0,
+ DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
},
/* 64 - 1920x1080@100Hz */
- { DRM_MODE("1920x1080", 297000, 1920, 2448,
- 2492, 2640, 0, 1080, 1084, 1094, 1125, 0,
- DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+ {
+ DRM_MODE("1920x1080", 297000, 1920, 2448,
+ 2492, 2640, 0, 1080, 1084, 1094, 1125, 0,
+ DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
},
/* TERMINATOR */
- { },
+ {},
};
-}
+} // namespace kms
diff --git a/kms++/src/modedb_dmt.cpp b/kms++/src/modedb_dmt.cpp
index 7dee6b1..21fe1c2 100644
--- a/kms++/src/modedb_dmt.cpp
+++ b/kms++/src/modedb_dmt.cpp
@@ -6,18 +6,17 @@
namespace kms
{
-
#define DIV_ROUND(n, d) (((n) + (d) / 2) / (d))
// hd, hss, hse, ht, vd, vss, vse, vt
-#define DRM_MODE(nm, c, hact, hfp, hsw, hbp, vact, vfp, vsw, vbp, f) \
- { \
- .name = nm, .clock = c, \
- .hdisplay = (hact), .hsync_start = (hact) + (hfp), .hsync_end = (hact) + (hfp) + (hsw), .htotal = (hact) + (hfp) + (hsw) + (hbp), .hskew = 0, \
- .vdisplay = (vact), .vsync_start = (vact) + (vfp), .vsync_end = (vact) + (vfp) + (vsw), .vtotal = (vact) + (vfp) + (vsw) + (vbp), .vscan = 0, \
- .vrefresh = DIV_ROUND(c * 1000, ((hact) + (hfp) + (hsw) + (hbp)) * ((vact) + (vfp) + (vsw) + (vbp))) * (((f) & DRM_MODE_FLAG_INTERLACE) ? 2 : 1), \
- .flags = (f), .type = 0 \
+#define DRM_MODE(nm, c, hact, hfp, hsw, hbp, vact, vfp, vsw, vbp, f) \
+ { \
+ .name = nm, .clock = c, \
+ .hdisplay = (hact), .hsync_start = (hact) + (hfp), .hsync_end = (hact) + (hfp) + (hsw), .htotal = (hact) + (hfp) + (hsw) + (hbp), .hskew = 0, \
+ .vdisplay = (vact), .vsync_start = (vact) + (vfp), .vsync_end = (vact) + (vfp) + (vsw), .vtotal = (vact) + (vfp) + (vsw) + (vbp), .vscan = 0, \
+ .vrefresh = DIV_ROUND(c * 1000, ((hact) + (hfp) + (hsw) + (hbp)) * ((vact) + (vfp) + (vsw) + (vbp))) * (((f)&DRM_MODE_FLAG_INTERLACE) ? 2 : 1), \
+ .flags = (f), .type = 0 \
}
const Videomode dmt_modes[] = {
@@ -198,7 +197,7 @@ const Videomode dmt_modes[] = {
// 0x58 - 4096 x 2160 @ 59.94 Hz CVT (Reduced Blanking v2)
DRM_MODE("4096 x 2160 @ 59.94 Hz CVT (Reduced Blanking v2)", 556188, 4096, 8, 32, 40, 2160, 48, 8, 6, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC),
/* TERMINATOR */
- { },
+ {},
};
-}
+} // namespace kms
diff --git a/kms++/src/omap/omapcard.cpp b/kms++/src/omap/omapcard.cpp
index 5e21c75..500bb72 100644
--- a/kms++/src/omap/omapcard.cpp
+++ b/kms++/src/omap/omapcard.cpp
@@ -9,7 +9,6 @@ using namespace std;
namespace kms
{
-
OmapCard::OmapCard(const string& device)
: Card(device)
{
@@ -21,4 +20,4 @@ OmapCard::~OmapCard()
omap_device_del(m_omap_dev);
}
-}
+} // namespace kms
diff --git a/kms++/src/omap/omapframebuffer.cpp b/kms++/src/omap/omapframebuffer.cpp
index f33a286..eac45e2 100644
--- a/kms++/src/omap/omapframebuffer.cpp
+++ b/kms++/src/omap/omapframebuffer.cpp
@@ -18,21 +18,20 @@ extern "C" {
}
#define __round_mask(x, y) ((__typeof__(x))((y)-1))
-#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)
+#define round_up(x, y) ((((x)-1) | __round_mask(x, y)) + 1)
#define PAGE_SIZE 4096
using namespace std;
namespace kms
{
-
OmapFramebuffer::OmapFramebuffer(OmapCard& card, uint32_t width, uint32_t height, const string& fourcc, Flags flags)
: OmapFramebuffer(card, width, height, FourCCToPixelFormat(fourcc), flags)
{
}
OmapFramebuffer::OmapFramebuffer(OmapCard& card, uint32_t width, uint32_t height, PixelFormat format, Flags flags)
- :Framebuffer(card, width, height), m_omap_card(card), m_format(format)
+ : Framebuffer(card, width, height), m_omap_card(card), m_format(format)
{
Create(flags);
}
@@ -80,23 +79,33 @@ void OmapFramebuffer::Create(Flags buffer_flags)
switch (m_format) {
case PixelFormat::NV12:
- bitspertiler = i == 0 ? 8 : 16; break;
+ bitspertiler = i == 0 ? 8 : 16;
+ break;
case PixelFormat::YUYV:
case PixelFormat::UYVY:
- bitspertiler = 32; break;
+ bitspertiler = 32;
+ break;
case PixelFormat::ARGB8888:
case PixelFormat::XRGB8888:
- bitspertiler = 32; break;
+ bitspertiler = 32;
+ break;
case PixelFormat::RGB565:
- bitspertiler = 16; break;
+ bitspertiler = 16;
+ break;
default:
throw invalid_argument("unimplemented format");
}
switch (bitspertiler) {
- case 8: flags |= OMAP_BO_TILED_8; break;
- case 16: flags |= OMAP_BO_TILED_16; break;
- case 32: flags |= OMAP_BO_TILED_32; break;
+ case 8:
+ flags |= OMAP_BO_TILED_8;
+ break;
+ case 16:
+ flags |= OMAP_BO_TILED_16;
+ break;
+ case 32:
+ flags |= OMAP_BO_TILED_32;
+ break;
default:
throw invalid_argument("bad bitspertiler");
}
@@ -125,7 +134,7 @@ void OmapFramebuffer::Create(Flags buffer_flags)
uint32_t offsets[4] = { m_planes[0].offset, m_planes[1].offset };
uint32_t id;
int r = drmModeAddFB2(card().fd(), width(), height(), (uint32_t)format(),
- bo_handles, pitches, offsets, &id, 0);
+ bo_handles, pitches, offsets, &id, 0);
if (r)
throw invalid_argument(string("drmModeAddFB2 failed: ") + strerror(errno));
@@ -181,4 +190,4 @@ int OmapFramebuffer::prime_fd(unsigned int plane)
return fd;
}
-}
+} // namespace kms
diff --git a/kms++/src/pixelformats.cpp b/kms++/src/pixelformats.cpp
index 2c60c1e..d739efd 100644
--- a/kms++/src/pixelformats.cpp
+++ b/kms++/src/pixelformats.cpp
@@ -8,54 +8,266 @@ namespace kms
{
static const map<PixelFormat, PixelFormatInfo> format_info_array = {
/* YUV packed */
- { PixelFormat::UYVY, { PixelColorType::YUV, 1, { { 16, 2, 1 } }, } },
- { PixelFormat::YUYV, { PixelColorType::YUV, 1, { { 16, 2, 1 } }, } },
- { PixelFormat::YVYU, { PixelColorType::YUV, 1, { { 16, 2, 1 } }, } },
- { PixelFormat::VYUY, { PixelColorType::YUV, 1, { { 16, 2, 1 } }, } },
+ { PixelFormat::UYVY, {
+ PixelColorType::YUV,
+ 1,
+ { { 16, 2, 1 } },
+ } },
+ { PixelFormat::YUYV, {
+ PixelColorType::YUV,
+ 1,
+ { { 16, 2, 1 } },
+ } },
+ { PixelFormat::YVYU, {
+ PixelColorType::YUV,
+ 1,
+ { { 16, 2, 1 } },
+ } },
+ { PixelFormat::VYUY, {
+ PixelColorType::YUV,
+ 1,
+ { { 16, 2, 1 } },
+ } },
/* YUV semi-planar */
- { PixelFormat::NV12, { PixelColorType::YUV, 2, { { 8, 1, 1, }, { 8, 2, 2 } }, } },
- { PixelFormat::NV21, { PixelColorType::YUV, 2, { { 8, 1, 1, }, { 8, 2, 2 } }, } },
- { PixelFormat::NV16, { PixelColorType::YUV, 2, { { 8, 1, 1, }, { 8, 2, 1 } }, } },
- { PixelFormat::NV61, { PixelColorType::YUV, 2, { { 8, 1, 1, }, { 8, 2, 1 } }, } },
+ { PixelFormat::NV12, {
+ PixelColorType::YUV,
+ 2,
+ { {
+ 8,
+ 1,
+ 1,
+ },
+ { 8, 2, 2 } },
+ } },
+ { PixelFormat::NV21, {
+ PixelColorType::YUV,
+ 2,
+ { {
+ 8,
+ 1,
+ 1,
+ },
+ { 8, 2, 2 } },
+ } },
+ { PixelFormat::NV16, {
+ PixelColorType::YUV,
+ 2,
+ { {
+ 8,
+ 1,
+ 1,
+ },
+ { 8, 2, 1 } },
+ } },
+ { PixelFormat::NV61, {
+ PixelColorType::YUV,
+ 2,
+ { {
+ 8,
+ 1,
+ 1,
+ },
+ { 8, 2, 1 } },
+ } },
/* YUV planar */
- { PixelFormat::YUV420, { PixelColorType::YUV, 3, { { 8, 1, 1, }, { 8, 2, 2 }, { 8, 2, 2 } }, } },
- { PixelFormat::YVU420, { PixelColorType::YUV, 3, { { 8, 1, 1, }, { 8, 2, 2 }, { 8, 2, 2 } }, } },
- { PixelFormat::YUV422, { PixelColorType::YUV, 3, { { 8, 1, 1, }, { 8, 2, 1 }, { 8, 2, 1 } }, } },
- { PixelFormat::YVU422, { PixelColorType::YUV, 3, { { 8, 1, 1, }, { 8, 2, 1 }, { 8, 2, 1 } }, } },
- { PixelFormat::YUV444, { PixelColorType::YUV, 3, { { 8, 1, 1, }, { 8, 1, 1 }, { 8, 1, 1 } }, } },
- { PixelFormat::YVU444, { PixelColorType::YUV, 3, { { 8, 1, 1, }, { 8, 1, 1 }, { 8, 1, 1 } }, } },
+ { PixelFormat::YUV420, {
+ PixelColorType::YUV,
+ 3,
+ { {
+ 8,
+ 1,
+ 1,
+ },
+ { 8, 2, 2 },
+ { 8, 2, 2 } },
+ } },
+ { PixelFormat::YVU420, {
+ PixelColorType::YUV,
+ 3,
+ { {
+ 8,
+ 1,
+ 1,
+ },
+ { 8, 2, 2 },
+ { 8, 2, 2 } },
+ } },
+ { PixelFormat::YUV422, {
+ PixelColorType::YUV,
+ 3,
+ { {
+ 8,
+ 1,
+ 1,
+ },
+ { 8, 2, 1 },
+ { 8, 2, 1 } },
+ } },
+ { PixelFormat::YVU422, {
+ PixelColorType::YUV,
+ 3,
+ { {
+ 8,
+ 1,
+ 1,
+ },
+ { 8, 2, 1 },
+ { 8, 2, 1 } },
+ } },
+ { PixelFormat::YUV444, {
+ PixelColorType::YUV,
+ 3,
+ { {
+ 8,
+ 1,
+ 1,
+ },
+ { 8, 1, 1 },
+ { 8, 1, 1 } },
+ } },
+ { PixelFormat::YVU444, {
+ PixelColorType::YUV,
+ 3,
+ { {
+ 8,
+ 1,
+ 1,
+ },
+ { 8, 1, 1 },
+ { 8, 1, 1 } },
+ } },
/* RGB8 */
- { PixelFormat::RGB332, { PixelColorType::RGB, 1, { { 8, 1, 1 } }, } },
+ { PixelFormat::RGB332, {
+ PixelColorType::RGB,
+ 1,
+ { { 8, 1, 1 } },
+ } },
/* RGB16 */
- { PixelFormat::RGB565, { PixelColorType::RGB, 1, { { 16, 1, 1 } }, } },
- { PixelFormat::BGR565, { PixelColorType::RGB, 1, { { 16, 1, 1 } }, } },
- { PixelFormat::XRGB4444, { PixelColorType::RGB, 1, { { 16, 1, 1 } }, } },
- { PixelFormat::XRGB1555, { PixelColorType::RGB, 1, { { 16, 1, 1 } }, } },
- { PixelFormat::ARGB4444, { PixelColorType::RGB, 1, { { 16, 1, 1 } }, } },
- { PixelFormat::ARGB1555, { PixelColorType::RGB, 1, { { 16, 1, 1 } }, } },
+ { PixelFormat::RGB565, {
+ PixelColorType::RGB,
+ 1,
+ { { 16, 1, 1 } },
+ } },
+ { PixelFormat::BGR565, {
+ PixelColorType::RGB,
+ 1,
+ { { 16, 1, 1 } },
+ } },
+ { PixelFormat::XRGB4444, {
+ PixelColorType::RGB,
+ 1,
+ { { 16, 1, 1 } },
+ } },
+ { PixelFormat::XRGB1555, {
+ PixelColorType::RGB,
+ 1,
+ { { 16, 1, 1 } },
+ } },
+ { PixelFormat::ARGB4444, {
+ PixelColorType::RGB,
+ 1,
+ { { 16, 1, 1 } },
+ } },
+ { PixelFormat::ARGB1555, {
+ PixelColorType::RGB,
+ 1,
+ { { 16, 1, 1 } },
+ } },
/* RGB24 */
- { PixelFormat::RGB888, { PixelColorType::RGB, 1, { { 24, 1, 1 } }, } },
- { PixelFormat::BGR888, { PixelColorType::RGB, 1, { { 24, 1, 1 } }, } },
+ { PixelFormat::RGB888, {
+ PixelColorType::RGB,
+ 1,
+ { { 24, 1, 1 } },
+ } },
+ { PixelFormat::BGR888, {
+ PixelColorType::RGB,
+ 1,
+ { { 24, 1, 1 } },
+ } },
/* RGB32 */
- { PixelFormat::XRGB8888, { PixelColorType::RGB, 1, { { 32, 1, 1 } }, } },
- { PixelFormat::XBGR8888, { PixelColorType::RGB, 1, { { 32, 1, 1 } }, } },
- { PixelFormat::RGBX8888, { PixelColorType::RGB, 1, { { 32, 1, 1 } }, } },
- { PixelFormat::BGRX8888, { PixelColorType::RGB, 1, { { 32, 1, 1 } }, } },
+ { PixelFormat::XRGB8888, {
+ PixelColorType::RGB,
+ 1,
+ { { 32, 1, 1 } },
+ } },
+ { PixelFormat::XBGR8888, {
+ PixelColorType::RGB,
+ 1,
+ { { 32, 1, 1 } },
+ } },
+ { PixelFormat::RGBX8888, {
+ PixelColorType::RGB,
+ 1,
+ { { 32, 1, 1 } },
+ } },
+ { PixelFormat::BGRX8888, {
+ PixelColorType::RGB,
+ 1,
+ { { 32, 1, 1 } },
+ } },
- { PixelFormat::ARGB8888, { PixelColorType::RGB, 1, { { 32, 1, 1 } }, } },
- { PixelFormat::ABGR8888, { PixelColorType::RGB, 1, { { 32, 1, 1 } }, } },
- { PixelFormat::RGBA8888, { PixelColorType::RGB, 1, { { 32, 1, 1 } }, } },
- { PixelFormat::BGRA8888, { PixelColorType::RGB, 1, { { 32, 1, 1 } }, } },
+ { PixelFormat::ARGB8888, {
+ PixelColorType::RGB,
+ 1,
+ { { 32, 1, 1 } },
+ } },
+ { PixelFormat::ABGR8888, {
+ PixelColorType::RGB,
+ 1,
+ { { 32, 1, 1 } },
+ } },
+ { PixelFormat::RGBA8888, {
+ PixelColorType::RGB,
+ 1,
+ { { 32, 1, 1 } },
+ } },
+ { PixelFormat::BGRA8888, {
+ PixelColorType::RGB,
+ 1,
+ { { 32, 1, 1 } },
+ } },
- { PixelFormat::XRGB2101010, { PixelColorType::RGB, 1, { { 32, 1, 1 } }, } },
- { PixelFormat::XBGR2101010, { PixelColorType::RGB, 1, { { 32, 1, 1 } }, } },
- { PixelFormat::RGBX1010102, { PixelColorType::RGB, 1, { { 32, 1, 1 } }, } },
- { PixelFormat::BGRX1010102, { PixelColorType::RGB, 1, { { 32, 1, 1 } }, } },
+ { PixelFormat::XRGB2101010, {
+ PixelColorType::RGB,
+ 1,
+ { { 32, 1, 1 } },
+ } },
+ { PixelFormat::XBGR2101010, {
+ PixelColorType::RGB,
+ 1,
+ { { 32, 1, 1 } },
+ } },
+ { PixelFormat::RGBX1010102, {
+ PixelColorType::RGB,
+ 1,
+ { { 32, 1, 1 } },
+ } },
+ { PixelFormat::BGRX1010102, {
+ PixelColorType::RGB,
+ 1,
+ { { 32, 1, 1 } },
+ } },
- { PixelFormat::ARGB2101010, { PixelColorType::RGB, 1, { { 32, 1, 1 } }, } },
- { PixelFormat::ABGR2101010, { PixelColorType::RGB, 1, { { 32, 1, 1 } }, } },
- { PixelFormat::RGBA1010102, { PixelColorType::RGB, 1, { { 32, 1, 1 } }, } },
- { PixelFormat::BGRA1010102, { PixelColorType::RGB, 1, { { 32, 1, 1 } }, } },
+ { PixelFormat::ARGB2101010, {
+ PixelColorType::RGB,
+ 1,
+ { { 32, 1, 1 } },
+ } },
+ { PixelFormat::ABGR2101010, {
+ PixelColorType::RGB,
+ 1,
+ { { 32, 1, 1 } },
+ } },
+ { PixelFormat::RGBA1010102, {
+ PixelColorType::RGB,
+ 1,
+ { { 32, 1, 1 } },
+ } },
+ { PixelFormat::BGRA1010102, {
+ PixelColorType::RGB,
+ 1,
+ { { 32, 1, 1 } },
+ } },
};
const struct PixelFormatInfo& get_pixel_format_info(PixelFormat format)
@@ -66,4 +278,4 @@ const struct PixelFormatInfo& get_pixel_format_info(PixelFormat format)
return format_info_array.at(format);
}
-}
+} // namespace kms
diff --git a/kms++/src/plane.cpp b/kms++/src/plane.cpp
index ffab3b5..bd426dd 100644
--- a/kms++/src/plane.cpp
+++ b/kms++/src/plane.cpp
@@ -13,14 +13,12 @@ using namespace std;
namespace kms
{
-
-struct PlanePriv
-{
+struct PlanePriv {
drmModePlanePtr drm_plane;
};
-Plane::Plane(Card &card, uint32_t id, uint32_t idx)
- :DrmPropObject(card, id, DRM_MODE_OBJECT_PLANE, idx)
+Plane::Plane(Card& card, uint32_t id, uint32_t idx)
+ : DrmPropObject(card, id, DRM_MODE_OBJECT_PLANE, idx)
{
m_priv = new PlanePriv();
m_priv->drm_plane = drmModeGetPlane(this->card().fd(), this->id());
@@ -76,7 +74,6 @@ vector<Crtc*> Plane::get_possible_crtcs() const
for (uint32_t crtc_mask = m_priv->drm_plane->possible_crtcs;
crtc_mask;
idx++, crtc_mask >>= 1) {
-
if ((crtc_mask & 1) == 0)
continue;
@@ -97,7 +94,7 @@ vector<PixelFormat> Plane::get_formats() const
vector<PixelFormat> r;
for (unsigned i = 0; i < p->count_formats; ++i)
- r.push_back((PixelFormat) p->formats[i]);
+ r.push_back((PixelFormat)p->formats[i]);
return r;
}
@@ -137,4 +134,4 @@ uint32_t Plane::gamma_size() const
return m_priv->drm_plane->gamma_size;
}
-}
+} // namespace kms
diff --git a/kms++/src/property.cpp b/kms++/src/property.cpp
index ee79922..0484f0e 100644
--- a/kms++/src/property.cpp
+++ b/kms++/src/property.cpp
@@ -7,9 +7,7 @@ using namespace std;
namespace kms
{
-
-struct PropertyPriv
-{
+struct PropertyPriv {
drmModePropertyPtr drm_prop;
};
@@ -84,4 +82,4 @@ vector<uint32_t> Property::get_blob_ids() const
drmModePropertyPtr p = m_priv->drm_prop;
return vector<uint32_t>(p->blob_ids, p->blob_ids + p->count_blobs);
}
-}
+} // namespace kms
diff --git a/kms++/src/videomode.cpp b/kms++/src/videomode.cpp
index 066896f..b039059 100644
--- a/kms++/src/videomode.cpp
+++ b/kms++/src/videomode.cpp
@@ -11,7 +11,6 @@ using namespace std;
namespace kms
{
-
bool Videomode::valid() const
{
return !!clock;
@@ -147,7 +146,7 @@ Videomode videomode_from_timings(uint32_t clock_khz,
uint16_t hact, uint16_t hfp, uint16_t hsw, uint16_t hbp,
uint16_t vact, uint16_t vfp, uint16_t vsw, uint16_t vbp)
{
- Videomode m { };
+ Videomode m{};
m.clock = clock_khz;
m.hdisplay = hact;
@@ -163,4 +162,4 @@ Videomode videomode_from_timings(uint32_t clock_khz,
return m;
}
-}
+} // namespace kms