gem5  v22.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/compiler.hh"
49 #include "base/imgwriter.hh"
50 #include "params/VncInput.hh"
51 #include "sim/sim_object.hh"
52 
53 namespace gem5
54 {
55 
56 class OutputDirectory;
57 
64 {
65  public:
72  virtual void keyPress(uint32_t key, bool down) = 0;
73 };
74 
75 class VncMouse
76 {
77  public:
86  virtual void mouseAt(uint16_t x, uint16_t y, uint8_t buttons) = 0;
87 };
88 
89 class VncInput : public SimObject
90 {
91  public:
92 
95  {
101  ClientCutText = 6
102  };
103 
105  {
106  uint8_t bpp;
107  uint8_t depth;
108  uint8_t bigendian;
109  uint8_t truecolor;
110  uint16_t redmax;
111  uint16_t greenmax;
112  uint16_t bluemax;
113  uint8_t redshift;
114  uint8_t greenshift;
115  uint8_t blueshift;
116  uint8_t padding[3];
117  };
118 
120  {
121  uint8_t type;
122  uint8_t padding[3];
124  };
125 
127  {
128  uint8_t type;
129  uint8_t padding;
130  uint16_t num_encodings;
131  };
132 
134  {
135  uint8_t type;
136  uint8_t incremental;
137  uint16_t x;
138  uint16_t y;
139  uint16_t width;
140  uint16_t height;
141  };
142 
144  {
145  uint8_t type;
146  uint8_t down_flag;
147  uint8_t padding[2];
148  uint32_t key;
149  };
150 
152  {
153  uint8_t type;
154  uint8_t button_mask;
155  uint16_t x;
156  uint16_t y;
157  };
158 
160  {
161  uint8_t type;
162  uint8_t padding[3];
163  uint32_t length;
164  };
165 
166  typedef VncInputParams Params;
167  VncInput(const Params &p);
168 
174  virtual void setFrameBuffer(const FrameBuffer *rfb);
175 
180  void setKeyboard(VncKeyboard *_keyboard) { keyboard = _keyboard; }
181 
186  void setMouse(VncMouse *_mouse) { mouse = _mouse; }
187 
193  uint16_t videoWidth() const { return _videoWidth; }
194 
200  uint16_t videoHeight() const { return _videoHeight; }
201 
206  virtual void setDirty();
207 
208  protected:
209  virtual void frameBufferResized() {};
210 
213 
216 
218  const FrameBuffer *fb;
219 
221  uint16_t _videoWidth;
222 
224  uint16_t _videoHeight;
225 
228 
231 
234 
236  uint64_t captureLastHash;
237 
239  std::unique_ptr<ImgWriter> captureImage;
240 
242  enums::ImageFormat imgFormat;
243 
245  void captureFrameBuffer();
246 };
247 
248 } // namespace gem5
249 
250 #endif
Internal gem5 representation of a frame buffer.
Definition: framebuffer.hh:69
Interface for creating files in a gem5 output directory.
Definition: output.hh:138
Abstract superclass for simulation objects.
Definition: sim_object.hh:148
const FrameBuffer * fb
pointer to the actual data that is stored in the frame buffer device
Definition: vncinput.hh:218
uint64_t captureLastHash
Computed hash of the last captured frame.
Definition: vncinput.hh:236
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:93
virtual void frameBufferResized()
Definition: vncinput.hh:209
VncInput(const Params &p)
Definition: vncinput.cc:55
virtual void setFrameBuffer(const FrameBuffer *rfb)
Set the address of the frame buffer we are going to show.
Definition: vncinput.cc:74
void captureFrameBuffer()
Captures the current frame buffer to a file.
Definition: vncinput.cc:113
void setMouse(VncMouse *_mouse)
Setup the device that would like to receive notifications when mouse movements or button presses are ...
Definition: vncinput.hh:186
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:180
VncInputParams Params
Definition: vncinput.hh:166
enums::ImageFormat imgFormat
image format
Definition: vncinput.hh:242
uint16_t videoHeight() const
What is the height of the screen we're displaying.
Definition: vncinput.hh:200
uint16_t _videoHeight
the height of the frame buffer we are sending to the client
Definition: vncinput.hh:224
uint16_t videoWidth() const
What is the width of the screen we're displaying.
Definition: vncinput.hh:193
OutputDirectory * captureOutputDirectory
Directory to store captured frames to.
Definition: vncinput.hh:233
VncKeyboard * keyboard
The device to notify when we get key events.
Definition: vncinput.hh:209
uint16_t _videoWidth
the width of the frame buffer we are sending to the client
Definition: vncinput.hh:221
bool captureEnabled
Flag indicating whether to capture snapshots of frame buffer or not.
Definition: vncinput.hh:227
VncMouse * mouse
The device to notify when we get mouse events.
Definition: vncinput.hh:215
ClientMessages
Client -> Server message IDs.
Definition: vncinput.hh:95
@ ClientSetEncodings
Definition: vncinput.hh:97
@ ClientSetPixelFormat
Definition: vncinput.hh:96
@ ClientFrameBufferUpdate
Definition: vncinput.hh:98
std::unique_ptr< ImgWriter > captureImage
Cached ImgWriter object for writing out frame buffers to file.
Definition: vncinput.hh:239
int captureCurrentFrame
Current frame number being captured to a file.
Definition: vncinput.hh:230
A device that expects to receive input from the vnc server should derrive (through mulitple inheriten...
Definition: vncinput.hh:64
virtual void keyPress(uint32_t key, bool down)=0
Called when the vnc server receives a key press event from the client.
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...
Bitfield< 4 > x
Definition: pagetable.hh:61
Bitfield< 54 > p
Definition: pagetable.hh:70
bool down
Definition: types.hh:136
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
PM4 packets.
Definition: pm4_defines.hh:78

Generated on Wed Dec 21 2022 10:22:29 for gem5 by doxygen 1.9.1