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 
23 #include "pedigree/kernel/Service.h"
24 #include "pedigree/kernel/ServiceFeatures.h"
25 #include "pedigree/kernel/processor/types.h"
26 #include "pedigree/kernel/utilities/List.h"
27 #include "pedigree/kernel/utilities/new"
28 
29 class Display;
30 class Framebuffer;
31 
32 class GraphicsService : public Service
33 {
34  public:
35  GraphicsService() : m_Providers(), m_pCurrentProvider(0)
36  {
37  }
38  virtual ~GraphicsService()
39  {
40  }
41 
43  {
44  Display *pDisplay;
45 
46  /* Some form of hardware caps here... */
47  bool bHardwareAccel;
48 
49  Framebuffer *pFramebuffer;
50 
51  size_t maxWidth;
52  size_t maxHeight;
53  size_t maxDepth;
54 
55  size_t maxTextWidth;
56  size_t maxTextHeight;
57 
61  bool bTextModes;
62  };
63 
65  {
66  // Typically, the current "best" provider will be used for a probe.
67  // However, setting this adjusts the determination of the best
68  // provider to give one with the largest possible text mode.
69  bool wantTextMode;
70 
71  // Provider target, the resulting provider will be copied into this.
72  // It is only valid if providerFound is true.
73  bool providerFound;
74  GraphicsProvider providerResult;
75  };
76 
78  bool serve(ServiceFeatures::Type type, void *pData, size_t dataLen);
79 
80  private:
81  struct ProviderPair
82  {
83  GraphicsProvider *bestBase;
84  GraphicsProvider *bestText;
85  };
86 
87  ProviderPair determineBestProvider();
88 
89  List<GraphicsProvider *> m_Providers;
90 
91  GraphicsProvider *m_pCurrentProvider;
92  GraphicsProvider *m_pCurrentTextProvider;
93 };
94 
95 #endif
Definition: List.h:64
bool serve(ServiceFeatures::Type type, void *pData, size_t dataLen)
Abstracts the system&#39;s framebuffer offering.