gem5  v20.1.0.0
vncinput.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010, 2015 ARM Limited
3  * All rights reserved
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions are
16  * met: redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer;
18  * redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution;
21  * neither the name of the copyright holders nor the names of its
22  * contributors may be used to endorse or promote products derived from
23  * this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
42 #ifndef __BASE_VNC_VNC_INPUT_HH__
43 #define __BASE_VNC_VNC_INPUT_HH__
44 
45 #include <iostream>
46 #include <memory>
47 
48 #include "base/imgwriter.hh"
49 #include "params/VncInput.hh"
50 #include "sim/sim_object.hh"
51 
52 class OutputDirectory;
53 
60 {
61  public:
68  virtual void keyPress(uint32_t key, bool down) = 0;
69 };
70 
71 class VncMouse
72 {
73  public:
82  virtual void mouseAt(uint16_t x, uint16_t y, uint8_t buttons) = 0;
83 };
84 
85 class VncInput : public SimObject
86 {
87  public:
88 
97  };
98 
99  struct PixelFormat {
100  uint8_t bpp;
101  uint8_t depth;
102  uint8_t bigendian;
103  uint8_t truecolor;
104  uint16_t redmax;
105  uint16_t greenmax;
106  uint16_t bluemax;
107  uint8_t redshift;
108  uint8_t greenshift;
109  uint8_t blueshift;
110  uint8_t padding[3];
111  } M5_ATTR_PACKED;
112 
114  uint8_t type;
115  uint8_t padding[3];
117  } M5_ATTR_PACKED;
118 
120  uint8_t type;
121  uint8_t padding;
122  uint16_t num_encodings;
123  } M5_ATTR_PACKED;
124 
126  uint8_t type;
127  uint8_t incremental;
128  uint16_t x;
129  uint16_t y;
130  uint16_t width;
131  uint16_t height;
132  } M5_ATTR_PACKED;
133 
135  uint8_t type;
136  uint8_t down_flag;
137  uint8_t padding[2];
138  uint32_t key;
139  } M5_ATTR_PACKED;
140 
142  uint8_t type;
143  uint8_t button_mask;
144  uint16_t x;
145  uint16_t y;
146  } M5_ATTR_PACKED;
147 
149  uint8_t type;
150  uint8_t padding[3];
151  uint32_t length;
152  } M5_ATTR_PACKED;
153 
154  typedef VncInputParams Params;
155  VncInput(const Params *p);
156 
162  virtual void setFrameBuffer(const FrameBuffer *rfb);
163 
168  void setKeyboard(VncKeyboard *_keyboard) { keyboard = _keyboard; }
169 
174  void setMouse(VncMouse *_mouse) { mouse = _mouse; }
175 
181  uint16_t videoWidth() const { return _videoWidth; }
182 
188  uint16_t videoHeight() const { return _videoHeight; }
189 
194  virtual void setDirty();
195 
196  protected:
197  virtual void frameBufferResized() {};
198 
201 
204 
206  const FrameBuffer *fb;
207 
209  uint16_t _videoWidth;
210 
212  uint16_t _videoHeight;
213 
216 
219 
222 
224  uint64_t captureLastHash;
225 
227  std::unique_ptr<ImgWriter> captureImage;
228 
230  Enums::ImageFormat imgFormat;
231 
233  void captureFrameBuffer();
234 };
235 #endif
VncInput::PixelFormat::truecolor
uint8_t truecolor
Definition: vncinput.hh:103
VncInput::PixelFormatMessage
Definition: vncinput.hh:113
VncInput::FrameBufferUpdateReq::height
uint16_t height
Definition: vncinput.hh:131
VncInput::FrameBufferUpdateReq::type
uint8_t type
Definition: vncinput.hh:126
VncInput::PixelEncodingsMessage::num_encodings
uint16_t num_encodings
Definition: vncinput.hh:122
VncInput::ClientCutTextMessage::type
uint8_t type
Definition: vncinput.hh:149
VncInput::PointerEventMessage::y
uint16_t y
Definition: vncinput.hh:145
OutputDirectory
Interface for creating files in a gem5 output directory.
Definition: output.hh:134
VncInput::PixelEncodingsMessage::type
uint8_t type
Definition: vncinput.hh:120
VncInput::VncInput
VncInput(const Params *p)
Definition: vncinput.cc:54
VncMouse::mouseAt
virtual void mouseAt(uint16_t x, uint16_t y, uint8_t buttons)=0
called whenever the mouse moves or it's button state changes buttons is a simple mask with each butto...
VncInput::_videoWidth
uint16_t _videoWidth
the width of the frame buffer we are sending to the client
Definition: vncinput.hh:209
VncInput::captureOutputDirectory
OutputDirectory * captureOutputDirectory
Directory to store captured frames to.
Definition: vncinput.hh:221
VncInput::Params
VncInputParams Params
Definition: vncinput.hh:154
VncInput::captureImage
std::unique_ptr< ImgWriter > captureImage
Cached ImgWriter object for writing out frame buffers to file.
Definition: vncinput.hh:227
VncInput::FrameBufferUpdateReq::x
uint16_t x
Definition: vncinput.hh:128
VncInput::FrameBufferUpdateReq::width
uint16_t width
Definition: vncinput.hh:130
VncInput::KeyEventMessage::type
uint8_t type
Definition: vncinput.hh:135
VncInput::PixelFormat::bpp
uint8_t bpp
Definition: vncinput.hh:100
imgwriter.hh
VncInput::PixelFormat::greenmax
uint16_t greenmax
Definition: vncinput.hh:105
VncInput
Definition: vncinput.hh:85
VncInput::captureEnabled
bool captureEnabled
Flag indicating whether to capture snapshots of frame buffer or not.
Definition: vncinput.hh:215
VncInput::PixelFormat::redmax
uint16_t redmax
Definition: vncinput.hh:104
VncInput::KeyEventMessage::padding
uint8_t padding[2]
Definition: vncinput.hh:137
VncInput::setDirty
virtual void setDirty()
The frame buffer uses this call to notify the vnc server that the frame buffer has been updated and a...
Definition: vncinput.cc:92
VncInput::_videoHeight
uint16_t _videoHeight
the height of the frame buffer we are sending to the client
Definition: vncinput.hh:212
VncInput::PointerEventMessage
Definition: vncinput.hh:141
VncInput::PixelFormat::greenshift
uint8_t greenshift
Definition: vncinput.hh:108
VncInput::PointerEventMessage::type
uint8_t type
Definition: vncinput.hh:142
VncInput::ClientCutTextMessage
Definition: vncinput.hh:148
VncInput::PixelFormat::padding
uint8_t padding[3]
Definition: vncinput.hh:110
VncInput::FrameBufferUpdateReq
Definition: vncinput.hh:125
VncInput::PixelFormatMessage::padding
uint8_t padding[3]
Definition: vncinput.hh:115
VncInput::PixelFormat::depth
uint8_t depth
Definition: vncinput.hh:101
VncInput::ClientMessages
ClientMessages
Client -> Server message IDs.
Definition: vncinput.hh:90
VncInput::FrameBufferUpdateReq::incremental
uint8_t incremental
Definition: vncinput.hh:127
sim_object.hh
VncKeyboard
A device that expects to receive input from the vnc server should derrive (through mulitple inheriten...
Definition: vncinput.hh:59
VncInput::KeyEventMessage::key
uint32_t key
Definition: vncinput.hh:138
VncInput::PixelFormat::redshift
uint8_t redshift
Definition: vncinput.hh:107
VncInput::PixelFormat::blueshift
uint8_t blueshift
Definition: vncinput.hh:109
VncInput::keyboard
VncKeyboard * keyboard
The device to notify when we get key events.
Definition: vncinput.hh:197
VncInput::setFrameBuffer
virtual void setFrameBuffer(const FrameBuffer *rfb)
Set the address of the frame buffer we are going to show.
Definition: vncinput.cc:73
Ps2::down
bool down
Definition: types.hh:123
RiscvISA::x
Bitfield< 3 > x
Definition: pagetable.hh:69
VncInput::ClientCutTextMessage::padding
uint8_t padding[3]
Definition: vncinput.hh:150
VncInput::ClientSetEncodings
@ ClientSetEncodings
Definition: vncinput.hh:92
VncInput::captureFrameBuffer
void captureFrameBuffer()
Captures the current frame buffer to a file.
Definition: vncinput.cc:112
VncKeyboard::keyPress
virtual void keyPress(uint32_t key, bool down)=0
Called when the vnc server receives a key press event from the client.
VncInput::captureLastHash
uint64_t captureLastHash
Computed hash of the last captured frame.
Definition: vncinput.hh:224
VncInput::ClientPointerEvent
@ ClientPointerEvent
Definition: vncinput.hh:95
VncInput::KeyEventMessage::down_flag
uint8_t down_flag
Definition: vncinput.hh:136
VncInput::PixelFormat::bluemax
uint16_t bluemax
Definition: vncinput.hh:106
VncInput::ClientCutText
@ ClientCutText
Definition: vncinput.hh:96
VncInput::PixelEncodingsMessage
Definition: vncinput.hh:119
VncInput::videoWidth
uint16_t videoWidth() const
What is the width of the screen we're displaying.
Definition: vncinput.hh:181
VncInput::setMouse
void setMouse(VncMouse *_mouse)
Setup the device that would like to receive notifications when mouse movements or button presses are ...
Definition: vncinput.hh:174
VncInput::PixelFormatMessage::type
uint8_t type
Definition: vncinput.hh:114
VncMouse
Definition: vncinput.hh:71
VncInput::captureCurrentFrame
int captureCurrentFrame
Current frame number being captured to a file.
Definition: vncinput.hh:218
VncInput::FrameBufferUpdateReq::y
uint16_t y
Definition: vncinput.hh:129
VncInput::M5_ATTR_PACKED
struct VncInput::PixelFormat M5_ATTR_PACKED
VncInput::setKeyboard
void setKeyboard(VncKeyboard *_keyboard)
Set up the device that would like to receive notifications when keys are pressed in the vnc client ke...
Definition: vncinput.hh:168
FrameBuffer
Internal gem5 representation of a frame buffer.
Definition: framebuffer.hh:65
VncInput::PixelEncodingsMessage::padding
uint8_t padding
Definition: vncinput.hh:121
VncInput::fb
const FrameBuffer * fb
pointer to the actual data that is stored in the frame buffer device
Definition: vncinput.hh:206
VncInput::ClientSetPixelFormat
@ ClientSetPixelFormat
Definition: vncinput.hh:91
VncInput::PixelFormat::bigendian
uint8_t bigendian
Definition: vncinput.hh:102
VncInput::imgFormat
Enums::ImageFormat imgFormat
image format
Definition: vncinput.hh:230
VncInput::PixelFormat
Definition: vncinput.hh:99
VncInput::videoHeight
uint16_t videoHeight() const
What is the height of the screen we're displaying.
Definition: vncinput.hh:188
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
VncInput::ClientKeyEvent
@ ClientKeyEvent
Definition: vncinput.hh:94
VncInput::mouse
VncMouse * mouse
The device to notify when we get mouse events.
Definition: vncinput.hh:203
VncInput::PixelFormatMessage::px
PixelFormat px
Definition: vncinput.hh:116
VncInput::ClientCutTextMessage::length
uint32_t length
Definition: vncinput.hh:151
VncInput::ClientFrameBufferUpdate
@ ClientFrameBufferUpdate
Definition: vncinput.hh:93
VncInput::frameBufferResized
virtual void frameBufferResized()
Definition: vncinput.hh:197
VncInput::PointerEventMessage::x
uint16_t x
Definition: vncinput.hh:144
VncInput::KeyEventMessage
Definition: vncinput.hh:134
VncInput::PointerEventMessage::button_mask
uint8_t button_mask
Definition: vncinput.hh:143
SimObject
Abstract superclass for simulation objects.
Definition: sim_object.hh:92

Generated on Wed Sep 30 2020 14:02:08 for gem5 by doxygen 1.8.17