|
|
121cca |
From 755371fc1590e752380822ffdb320484e3b6851f Mon Sep 17 00:00:00 2001
|
|
|
121cca |
From: Lyonel Vincent <lyonel@ezix.org>
|
|
|
121cca |
Date: Thu, 2 Apr 2020 14:54:03 +0200
|
|
|
121cca |
Subject: [PATCH 10/65] detect framebuffers
|
|
|
121cca |
|
|
|
121cca |
---
|
|
|
121cca |
src/core/graphics.cc | 44 ++++++++++++++++++++++++++++++++++++++++++++
|
|
|
121cca |
src/core/graphics.h | 8 ++++++++
|
|
|
121cca |
src/core/main.cc | 4 ++++
|
|
|
121cca |
4 files changed, 57 insertions(+), 1 deletion(-)
|
|
|
121cca |
create mode 100644 src/core/graphics.cc
|
|
|
121cca |
create mode 100644 src/core/graphics.h
|
|
|
121cca |
|
|
|
121cca |
diff --git a/src/core/graphics.cc b/src/core/graphics.cc
|
|
|
121cca |
new file mode 100644
|
|
|
121cca |
index 0000000..a8d490c
|
|
|
121cca |
--- /dev/null
|
|
|
121cca |
+++ b/src/core/graphics.cc
|
|
|
121cca |
@@ -0,0 +1,44 @@
|
|
|
121cca |
+#include "version.h"
|
|
|
121cca |
+#include "hw.h"
|
|
|
121cca |
+#include "sysfs.h"
|
|
|
121cca |
+#include "osutils.h"
|
|
|
121cca |
+#include "graphics.h"
|
|
|
121cca |
+#include "heuristics.h"
|
|
|
121cca |
+
|
|
|
121cca |
+#include <vector>
|
|
|
121cca |
+#include <iostream>
|
|
|
121cca |
+
|
|
|
121cca |
+__ID("@(#) $Id$");
|
|
|
121cca |
+
|
|
|
121cca |
+using namespace std;
|
|
|
121cca |
+
|
|
|
121cca |
+bool scan_graphics(hwNode & n)
|
|
|
121cca |
+{
|
|
|
121cca |
+ vector < sysfs::entry > entries = sysfs::entries_by_class("graphics");
|
|
|
121cca |
+
|
|
|
121cca |
+ if (entries.empty())
|
|
|
121cca |
+ return false;
|
|
|
121cca |
+
|
|
|
121cca |
+ for (vector < sysfs::entry >::iterator it = entries.begin();
|
|
|
121cca |
+ it != entries.end(); ++it)
|
|
|
121cca |
+ {
|
|
|
121cca |
+ const sysfs::entry & e = *it;
|
|
|
121cca |
+ string dev = e.string_attr("dev");
|
|
|
121cca |
+ if(dev!="")
|
|
|
121cca |
+ {
|
|
|
121cca |
+ hwNode *device = n.findChildByBusInfo(e.leaf().businfo());
|
|
|
121cca |
+ if(!device)
|
|
|
121cca |
+ device = n.addChild(hwNode("graphics", hw::display));
|
|
|
121cca |
+ device->claim();
|
|
|
121cca |
+ device->setLogicalName(e.name());
|
|
|
121cca |
+ device->addCapability("fb", "framebuffer");
|
|
|
121cca |
+ if(device->getProduct() == "") device->setProduct(e.string_attr("name"));
|
|
|
121cca |
+ string resolution = e.string_attr("virtual_size");
|
|
|
121cca |
+ string depth = e.string_attr("bits_per_pixel");
|
|
|
121cca |
+ if(resolution != "") device->setConfig("resolution", resolution);
|
|
|
121cca |
+ if(depth != "") device->setConfig("depth", depth);
|
|
|
121cca |
+ }
|
|
|
121cca |
+ }
|
|
|
121cca |
+
|
|
|
121cca |
+ return true;
|
|
|
121cca |
+}
|
|
|
121cca |
diff --git a/src/core/graphics.h b/src/core/graphics.h
|
|
|
121cca |
new file mode 100644
|
|
|
121cca |
index 0000000..c30f0bf
|
|
|
121cca |
--- /dev/null
|
|
|
121cca |
+++ b/src/core/graphics.h
|
|
|
121cca |
@@ -0,0 +1,8 @@
|
|
|
121cca |
+#ifndef _GRAPHICS_H_
|
|
|
121cca |
+#define _GRAPHICS_H_
|
|
|
121cca |
+
|
|
|
121cca |
+#include "hw.h"
|
|
|
121cca |
+
|
|
|
121cca |
+bool scan_graphics(hwNode &);
|
|
|
121cca |
+
|
|
|
121cca |
+#endif
|
|
|
121cca |
diff --git a/src/core/main.cc b/src/core/main.cc
|
|
|
121cca |
index e35258c..ac2fba0 100644
|
|
|
121cca |
--- a/src/core/main.cc
|
|
|
121cca |
+++ b/src/core/main.cc
|
|
|
121cca |
@@ -47,6 +47,7 @@
|
|
|
121cca |
#include "mmc.h"
|
|
|
121cca |
#include "input.h"
|
|
|
121cca |
#include "sound.h"
|
|
|
121cca |
+#include "graphics.h"
|
|
|
121cca |
#include "smp.h"
|
|
|
121cca |
#include "abi.h"
|
|
|
121cca |
#include "s390.h"
|
|
|
121cca |
@@ -145,6 +146,9 @@ bool scan_system(hwNode & system)
|
|
|
121cca |
status("sound");
|
|
|
121cca |
if (enabled("sound"))
|
|
|
121cca |
scan_sound(computer);
|
|
|
121cca |
+ status("graphics");
|
|
|
121cca |
+ if (enabled("graphics"))
|
|
|
121cca |
+ scan_graphics(computer);
|
|
|
121cca |
status("input");
|
|
|
121cca |
if (enabled("input"))
|
|
|
121cca |
scan_input(computer);
|
|
|
121cca |
--
|
|
|
121cca |
2.33.1
|
|
|
121cca |
|