The Pedigree Project 0.1
GraphicsService.h
1/*
2 * Copyright (c) 2008-2014, Pedigree Developers
3 *
4 * Please see the CONTRIB file in the root of the source tree for a full
5 * list of contributors.
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20#ifndef _GRAPHICS_SERVICE_H
21#define _GRAPHICS_SERVICE_H
22#include "pedigree/kernel/Service.h"
23#include "pedigree/kernel/ServiceFeatures.h"
24#include "pedigree/kernel/process/Mutex.h"
25#include "pedigree/kernel/processor/types.h"
26#include "pedigree/kernel/utilities/List.h"
27#include "pedigree/kernel/utilities/new"
28
29#include <config.h>
30
31class Display;
32class Framebuffer;
33
34class GraphicsService : public Service {
35 public:
37 : m_Providers(), m_pCurrentProvider(0), m_pCurrentTextProvider(0), m_ProviderLock() {}
38 virtual ~GraphicsService() {}
39
41 Display* pDisplay;
42
43 /* Some form of hardware caps here... */
44 bool bHardwareAccel;
45
46 Framebuffer* pFramebuffer;
47
48 size_t maxWidth;
49 size_t maxHeight;
50 size_t maxDepth;
51
52 size_t maxTextWidth;
53 size_t maxTextHeight;
54
59
61 bool bFirmwareFallback = false;
62 };
63
65 // Typically, the current "best" provider will be used for a probe.
66 // However, setting this adjusts the determination of the best
67 // provider to give one with the largest possible text mode.
68 bool wantTextMode;
69
70 // Provider target, the resulting provider will be copied into this.
71 // It is only valid if providerFound is true.
72 bool providerFound;
73 GraphicsProvider providerResult;
74 };
75
77 bool serve(ServiceFeatures::Type type, void* pData, size_t dataLen);
78
79 private:
80 struct ProviderPair {
81 GraphicsProvider* bestBase;
82 GraphicsProvider* bestText;
83 };
84
85 ProviderPair determineBestProvider();
86
87 List<GraphicsProvider*> m_Providers;
88
89 GraphicsProvider* m_pCurrentProvider;
90 GraphicsProvider* m_pCurrentTextProvider;
91
92 Mutex m_ProviderLock;
93};
94
95#endif
bool serve(ServiceFeatures::Type type, void *pData, size_t dataLen)
Definition List.h:61
Definition Mutex.h:56
bool bFirmwareFallback
Firmware scanout is a fallback once a native driver owns the display.