mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-22 04:52:56 +01:00
use fifo also for vgpus
This commit is contained in:
@@ -18,15 +18,17 @@ void Scheduler::schedule_next()
|
||||
VGpu* first = nullptr;
|
||||
do
|
||||
{
|
||||
VGpu* next;
|
||||
if ((next = static_cast<VGpu*>(_run_list.first())))
|
||||
VGpu* next = nullptr;
|
||||
_run_list.dequeue([&next](VGpu& vgpu){
|
||||
next = &vgpu;
|
||||
});
|
||||
if(next != nullptr)
|
||||
{
|
||||
// set vgpu
|
||||
_curr_vgpu = next;
|
||||
|
||||
// move vgpu to end of list
|
||||
_run_list.remove(next);
|
||||
_run_list.insert(next);
|
||||
// add vgpu back to end of list
|
||||
_run_list.enqueue(*next);
|
||||
|
||||
// complete iteration?
|
||||
if(first == next)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef SCHEDULER_H
|
||||
#define SCHEDULER_H
|
||||
|
||||
#include <util/list.h>
|
||||
#include <util/fifo.h>
|
||||
#include "vgpu.h"
|
||||
|
||||
namespace gpgpu_virt {
|
||||
@@ -10,7 +10,7 @@ namespace gpgpu_virt {
|
||||
{
|
||||
private:
|
||||
VGpu* _curr_vgpu;
|
||||
Genode::List<VGpu> _run_list;
|
||||
Genode::Fifo<VGpu> _run_list;
|
||||
bool idle;
|
||||
|
||||
public:
|
||||
@@ -50,7 +50,7 @@ namespace gpgpu_virt {
|
||||
*/
|
||||
void add_vgpu(VGpu* vgpu)
|
||||
{
|
||||
_run_list.insert(vgpu);
|
||||
_run_list.enqueue(*vgpu);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,7 +60,7 @@ namespace gpgpu_virt {
|
||||
*/
|
||||
void remove_vgpu(VGpu* vgpu)
|
||||
{
|
||||
_run_list.remove(vgpu);
|
||||
_run_list.remove(*vgpu);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef VGPU_H
|
||||
#define VGPU_H
|
||||
|
||||
#include <util/list.h>
|
||||
#include <util/fifo.h>
|
||||
#include "kernel.h"
|
||||
|
||||
@@ -12,7 +11,7 @@
|
||||
|
||||
namespace gpgpu_virt {
|
||||
|
||||
class VGpu : public Genode::List<VGpu>::Element
|
||||
class VGpu : public Genode::Fifo<VGpu>::Element
|
||||
{
|
||||
private:
|
||||
// context of vgpu
|
||||
|
||||
Reference in New Issue
Block a user