]> git.ameliathe1st.gay Git - voyage-au-centre-des-fichiers.git/commitdiff
Removed the framebuffer code: I will not be using it until it is reimplemented in...
authorAmelia Coutard <eliottulio.coutard@gmail.com>
Thu, 26 May 2022 02:37:26 +0000 (04:37 +0200)
committerAmelia Coutard <eliottulio.coutard@gmail.com>
Thu, 26 May 2022 02:37:26 +0000 (04:37 +0200)
src/fb.cpp [deleted file]
src/fb.hpp [deleted file]
src/kernel.cpp

diff --git a/src/fb.cpp b/src/fb.cpp
deleted file mode 100644 (file)
index ff0beca..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-#include "serial.hpp"
-#include "utils.hpp"
-#include "fb.hpp"
-
-os::color os::operator*(color c1, color c2) {
-       return {
-               .r = std::uint8_t(int(c1.r) * int(c2.r) / 256),
-               .g = std::uint8_t(int(c1.g) * int(c2.g) / 256),
-               .b = std::uint8_t(int(c1.b) * int(c2.b) / 256),
-       };
-}
-
-os::framebuffer::framebuffer(std::uint64_t addr, std::uint32_t pitch, std::uint32_t width, std::uint32_t height, std::uint8_t bpp, std::uint8_t type, const std::uint8_t* color_info) {
-       address = phys_ptr<volatile std::uint8_t>(addr);
-       this->pitch = pitch;
-       this->width = width;
-       this->height = height;
-       this->bpp = bpp;
-       os::assert(type == 1, "Framebuffer not in direct RGB mode.");
-       os::assert(bpp == 32, "Framebuffer bpp != 32.");
-
-       r_pos =  color_info[0];
-       r_mask = (1 << color_info[1]) - 1;
-       g_pos =  color_info[2];
-       g_mask = (1 << color_info[3]) - 1;
-       b_pos =  color_info[4];
-       b_mask = (1 << color_info[5]) - 1;
-}
-void os::framebuffer::putpixel(std::size_t x, std::size_t y, color c) {
-       *reinterpret_cast<volatile std::uint32_t*>(&address[pitch * y + x * bpp / 8]) = color_to_data(c);
-}
-void os::framebuffer::clear(color c) {
-       for (std::size_t x = 0; x < width; x++) {
-               for (std::size_t y = 0; y < height; y++) {
-                       putpixel(x, y, c);
-               }
-       }
-}
-std::size_t os::framebuffer::get_width() const {
-       return width;
-}
-std::size_t os::framebuffer::get_height() const {
-       return height;
-}
-
-std::uint32_t os::framebuffer::color_to_data(color c) const {
-return ((std::uint32_t(c.r) & r_mask) << r_pos) | ((std::uint32_t(c.g) & g_mask) << g_pos) | ((std::uint32_t(c.b) & b_mask) << b_pos);
-}
diff --git a/src/fb.hpp b/src/fb.hpp
deleted file mode 100644 (file)
index 7acb6af..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-#pragma once
-
-#include <cstdint>
-#include "phys_ptr.hpp"
-
-namespace os {
-
-struct color {
-       std::uint8_t r;
-       std::uint8_t g;
-       std::uint8_t b;
-};
-color operator*(color c1, color c2);
-
-class framebuffer {
-public:
-       framebuffer() = default;
-       framebuffer(std::uint64_t addr, std::uint32_t pitch, std::uint32_t width, std::uint32_t height, std::uint8_t bpp, std::uint8_t type, const std::uint8_t* color_info);
-       void putpixel(std::size_t x, std::size_t y, color c);
-       void clear(color c);
-       std::size_t get_width() const;
-       std::size_t get_height() const;
-
-private:
-       std::uint32_t color_to_data(color c) const;
-
-       phys_ptr<volatile std::uint8_t> address = nullptr;
-       std::size_t pitch;
-       std::size_t width;
-       std::size_t height;
-       std::uint8_t bpp;
-       std::uint8_t r_pos;
-       std::uint8_t r_mask;
-       std::uint8_t g_pos;
-       std::uint8_t g_mask;
-       std::uint8_t b_pos;
-       std::uint8_t b_mask;
-};
-
-}
index 01ae69b2a78330cd7611c36724f18d29d3b332e0..3ca6bd482f5aeaea216aaffb32e7771ff2ab8c06 100644 (file)
@@ -1,6 +1,5 @@
 #include "multiboot2.hpp"
 #include "paging.hpp"
-#include "fb.hpp"
 #include "utils.hpp"
 #include "serial.hpp"
 #include "interrupts.hpp"
@@ -54,26 +53,8 @@ extern "C" void kmain(unsigned long magic, os::phys_ptr<const multiboot2::info_s
        const os::phys_ptr<os::paging::page> info_end{(info.get_phys_addr() + info->total_size + 0x1000 - 1) / 0x1000 * 0x1000}; // Round end up.
        bool info_pages_wholly_usable = false;
 
-       os::framebuffer framebuffer;
-
        for (auto it = multiboot2::next(info); it->type != multiboot2::info::type_t::end; it = multiboot2::next(it)) {
                switch (it->type) {
-               case multiboot2::info::type_t::framebuffer_info:
-                       os::print("Framebuffer:\n");
-                       os::print(multiboot2::framebuffer_addr(it));
-                       os::print("->");
-                       os::print(multiboot2::framebuffer_addr(it) + multiboot2::framebuffer_pitch(it) * multiboot2::framebuffer_height(it));
-                       os::printc('\n');
-                       framebuffer = os::framebuffer(
-                               multiboot2::framebuffer_addr(it),
-                               multiboot2::framebuffer_pitch(it),
-                               multiboot2::framebuffer_width(it),
-                               multiboot2::framebuffer_height(it),
-                               multiboot2::framebuffer_bpp(it),
-                               multiboot2::framebuffer_type(it),
-                               multiboot2::color_info(it)
-                       );
-                       break;
                case multiboot2::info::type_t::memory_map:
                        for (std::size_t i = 0; i < multiboot2::memory_map_number_of_entries(it); i++) {
                                if (multiboot2::memory_map_type(it, i) == 1) {
@@ -122,16 +103,6 @@ extern "C" void kmain(unsigned long magic, os::phys_ptr<const multiboot2::info_s
        os::print("RAM:\n");
        page_allocator.print_all();
 
-       for (std::size_t x = 0; x < framebuffer.get_width(); x++) {
-               for (std::size_t y = 0; y < framebuffer.get_height(); y++) {
-                       framebuffer.putpixel(x, y, {
-                               .r = std::uint8_t(x * 256 / framebuffer.get_width()),
-                               .g = 0,
-                               .b = std::uint8_t(y * 256 / framebuffer.get_height()),
-                       });
-               }
-       }
-
        os::enable_interrupts();
 
        while (true) {