Line data Source code
1 :
2 : /* Copyright (c) 2011, Stefan Eilemann <eile@eyescale.ch>
3 : *
4 : * This library is free software; you can redistribute it and/or modify it under
5 : * the terms of the GNU Lesser General Public License version 2.1 as published
6 : * by the Free Software Foundation.
7 : *
8 : * This library is distributed in the hope that it will be useful, but WITHOUT
9 : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 : * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 : * details.
12 : *
13 : * You should have received a copy of the GNU Lesser General Public License
14 : * along with this library; if not, write to the Free Software Foundation, Inc.,
15 : * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 : */
17 :
18 : #ifndef EQFABRIC_GPUINFO_H
19 : #define EQFABRIC_GPUINFO_H
20 :
21 : #include <eq/fabric/pixelViewport.h>
22 : #include <eq/fabric/types.h>
23 : #include <iostream>
24 :
25 : namespace eq
26 : {
27 : namespace fabric
28 : {
29 : /** A structure containing GPU-specific information. */
30 30 : struct GPUInfo
31 : {
32 : /** Default constructor pointing to default display. */
33 30 : GPUInfo() : port( LB_UNDEFINED_UINT32 ), device( LB_UNDEFINED_UINT32 )
34 30 : {}
35 :
36 : /** @return true if both infos are identical. @version 1.0 */
37 : bool operator == ( const GPUInfo& rhs ) const
38 : { return port==rhs.port && device==rhs.device && pvp==rhs.pvp; }
39 :
40 : /** @return true if both infos are not identical. @version 1.0 */
41 : bool operator != ( const GPUInfo& rhs ) const
42 : { return port!=rhs.port || device!=rhs.device || pvp!=rhs.pvp; }
43 :
44 : /** The display (GLX) or ignored (Win32, AGL). */
45 : uint32_t port;
46 :
47 : /** The screen (GLX), GPU (Win32) or virtual screen (AGL). */
48 : uint32_t device;
49 :
50 : /** The size and location of the GPU. */
51 : PixelViewport pvp;
52 :
53 : std::string hostname; //!< remote system hostname, empty for local GPUs
54 : };
55 :
56 : inline std::ostream& operator << ( std::ostream& os, const GPUInfo& info )
57 : {
58 : if( !info.hostname.empty( ))
59 : os << "hostname " << info.hostname << std::endl;
60 : if( info.port != LB_UNDEFINED_UINT32 )
61 : os << "port " << info.port << std::endl;
62 : if( info.device != LB_UNDEFINED_UINT32 )
63 : os << "device " << info.device << std::endl;
64 : if( info.pvp.isValid( ))
65 : os << "viewport " << info.pvp << std::endl;
66 : return os;
67 : }
68 :
69 : }
70 : }
71 : #endif // EQFABRIC_GPUINFO_H
72 :
|