mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 05:27:20 +00:00
[all] expose the FrameBuffer struct for correct sizeof calculations
This commit is contained in:
parent
9846762991
commit
17e05c6fd5
@ -91,7 +91,7 @@ typedef struct CaptureInterface
|
||||
unsigned int (*getMaxFrameSize)();
|
||||
|
||||
CaptureResult (*capture )();
|
||||
CaptureResult (*waitFrame )(CaptureFrame * frame);
|
||||
CaptureResult (*getFrame )(FrameBuffer frame);
|
||||
CaptureResult (*waitFrame )(CaptureFrame * frame);
|
||||
CaptureResult (*getFrame )(FrameBuffer * frame);
|
||||
}
|
||||
CaptureInterface;
|
@ -805,7 +805,7 @@ static CaptureResult dxgi_waitFrame(CaptureFrame * frame)
|
||||
return CAPTURE_RESULT_OK;
|
||||
}
|
||||
|
||||
static CaptureResult dxgi_getFrame(FrameBuffer frame)
|
||||
static CaptureResult dxgi_getFrame(FrameBuffer * frame)
|
||||
{
|
||||
assert(this);
|
||||
assert(this->initialized);
|
||||
|
@ -294,7 +294,7 @@ static CaptureResult nvfbc_waitFrame(CaptureFrame * frame)
|
||||
return CAPTURE_RESULT_OK;
|
||||
}
|
||||
|
||||
static CaptureResult nvfbc_getFrame(FrameBuffer frame)
|
||||
static CaptureResult nvfbc_getFrame(FrameBuffer * frame)
|
||||
{
|
||||
framebuffer_write(
|
||||
frame,
|
||||
|
@ -188,7 +188,7 @@ static int frameThread(void * opaque)
|
||||
|
||||
// put the framebuffer on the border of the next page
|
||||
// this is to allow for aligned DMA transfers by the receiver
|
||||
FrameBuffer fb = (FrameBuffer)(((uint8_t*)fi) + fi->offset);
|
||||
FrameBuffer * fb = (FrameBuffer *)(((uint8_t*)fi) + fi->offset);
|
||||
framebuffer_prepare(fb);
|
||||
|
||||
/* we post and then get the frame, this is intentional! */
|
||||
|
@ -90,7 +90,7 @@ typedef void (* LG_RendererDeInitialize)(void * opaque);
|
||||
typedef void (* LG_RendererOnResize )(void * opaque, const int width, const int height, const LG_RendererRect destRect);
|
||||
typedef bool (* LG_RendererOnMouseShape)(void * opaque, const LG_RendererCursor cursor, const int width, const int height, const int pitch, const uint8_t * data);
|
||||
typedef bool (* LG_RendererOnMouseEvent)(void * opaque, const bool visible , const int x, const int y);
|
||||
typedef bool (* LG_RendererOnFrameEvent)(void * opaque, const LG_RendererFormat format, const FrameBuffer frame);
|
||||
typedef bool (* LG_RendererOnFrameEvent)(void * opaque, const LG_RendererFormat format, const FrameBuffer * frame);
|
||||
typedef void (* LG_RendererOnAlert )(void * opaque, const LG_MsgAlert alert, const char * message, bool ** closeFlag);
|
||||
typedef bool (* LG_RendererRender )(void * opaque, SDL_Window *window);
|
||||
typedef void (* LG_RendererUpdateFPS )(void * opaque, const float avgUPS, const float avgFPS);
|
||||
|
@ -60,7 +60,7 @@ struct EGL_Desktop
|
||||
enum EGL_PixelFormat pixFmt;
|
||||
unsigned int width, height;
|
||||
unsigned int pitch;
|
||||
FrameBuffer frame;
|
||||
const FrameBuffer * frame;
|
||||
bool update;
|
||||
|
||||
// night vision
|
||||
@ -181,7 +181,7 @@ void egl_desktop_free(EGL_Desktop ** desktop)
|
||||
*desktop = NULL;
|
||||
}
|
||||
|
||||
bool egl_desktop_prepare_update(EGL_Desktop * desktop, const bool sourceChanged, const LG_RendererFormat format, const FrameBuffer frame)
|
||||
bool egl_desktop_prepare_update(EGL_Desktop * desktop, const bool sourceChanged, const LG_RendererFormat format, const FrameBuffer * frame)
|
||||
{
|
||||
if (sourceChanged)
|
||||
{
|
||||
|
@ -28,6 +28,6 @@ typedef struct EGL_Desktop EGL_Desktop;
|
||||
bool egl_desktop_init(EGL_Desktop ** desktop);
|
||||
void egl_desktop_free(EGL_Desktop ** desktop);
|
||||
|
||||
bool egl_desktop_prepare_update(EGL_Desktop * desktop, const bool sourceChanged, const LG_RendererFormat format, const FrameBuffer frame);
|
||||
bool egl_desktop_prepare_update(EGL_Desktop * desktop, const bool sourceChanged, const LG_RendererFormat format, const FrameBuffer * frame);
|
||||
void egl_desktop_perform_update(EGL_Desktop * desktop, const bool sourceChanged);
|
||||
bool egl_desktop_render(EGL_Desktop * desktop, const float x, const float y, const float scaleX, const float scaleY, const bool nearest);
|
@ -295,7 +295,7 @@ bool egl_on_mouse_event(void * opaque, const bool visible, const int x, const in
|
||||
return true;
|
||||
}
|
||||
|
||||
bool egl_on_frame_event(void * opaque, const LG_RendererFormat format, const FrameBuffer frame)
|
||||
bool egl_on_frame_event(void * opaque, const LG_RendererFormat format, const FrameBuffer * frame)
|
||||
{
|
||||
struct Inst * this = (struct Inst *)opaque;
|
||||
this->sourceChanged = (
|
||||
|
@ -279,7 +279,7 @@ bool egl_texture_update(EGL_Texture * texture, const uint8_t * buffer)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool egl_texture_update_from_frame(EGL_Texture * texture, const FrameBuffer frame)
|
||||
bool egl_texture_update_from_frame(EGL_Texture * texture, const FrameBuffer * frame)
|
||||
{
|
||||
if (!texture->streaming)
|
||||
return false;
|
||||
|
@ -47,7 +47,7 @@ void egl_texture_free(EGL_Texture ** tex);
|
||||
|
||||
bool egl_texture_setup (EGL_Texture * texture, enum EGL_PixelFormat pixfmt, size_t width, size_t height, size_t stride, bool streaming);
|
||||
bool egl_texture_update (EGL_Texture * texture, const uint8_t * buffer);
|
||||
bool egl_texture_update_from_frame(EGL_Texture * texture, const FrameBuffer frame);
|
||||
bool egl_texture_update_from_frame(EGL_Texture * texture, const FrameBuffer * frame);
|
||||
enum EGL_TexStatus egl_texture_process(EGL_Texture * texture);
|
||||
enum EGL_TexStatus egl_texture_bind (EGL_Texture * texture);
|
||||
int egl_texture_count (EGL_Texture * texture);
|
@ -116,14 +116,14 @@ struct Inst
|
||||
const LG_Font * font;
|
||||
LG_FontObj fontObj, alertFontObj;
|
||||
|
||||
LG_Lock formatLock;
|
||||
LG_RendererFormat format;
|
||||
GLuint intFormat;
|
||||
GLuint vboFormat;
|
||||
GLuint dataFormat;
|
||||
size_t texSize;
|
||||
size_t texPos;
|
||||
FrameBuffer frame;
|
||||
LG_Lock formatLock;
|
||||
LG_RendererFormat format;
|
||||
GLuint intFormat;
|
||||
GLuint vboFormat;
|
||||
GLuint dataFormat;
|
||||
size_t texSize;
|
||||
size_t texPos;
|
||||
const FrameBuffer * frame;
|
||||
|
||||
uint64_t drawStart;
|
||||
bool hasBuffers;
|
||||
@ -368,7 +368,7 @@ bool opengl_on_mouse_event(void * opaque, const bool visible, const int x, const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool opengl_on_frame_event(void * opaque, const LG_RendererFormat format, const FrameBuffer frame)
|
||||
bool opengl_on_frame_event(void * opaque, const LG_RendererFormat format, const FrameBuffer * frame)
|
||||
{
|
||||
struct Inst * this = (struct Inst *)opaque;
|
||||
if (!this)
|
||||
|
@ -440,7 +440,7 @@ static int frameThread(void * unused)
|
||||
updatePositionInfo();
|
||||
}
|
||||
|
||||
FrameBuffer fb = (FrameBuffer)(((uint8_t*)frame) + frame->offset);
|
||||
FrameBuffer * fb = (FrameBuffer *)(((uint8_t*)frame) + frame->offset);
|
||||
if (!state.lgr->on_frame_event(state.lgrData, lgrFormat, fb))
|
||||
{
|
||||
DEBUG_ERROR("renderer on frame event returned failure");
|
||||
|
@ -23,26 +23,33 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct stFrameBuffer * FrameBuffer;
|
||||
|
||||
typedef struct stFrameBuffer
|
||||
{
|
||||
uint64_t wp;
|
||||
uint8_t data[0];
|
||||
}
|
||||
FrameBuffer;
|
||||
|
||||
|
||||
typedef bool (*FrameBufferReadFn)(void * opaque, const void * src, size_t size);
|
||||
|
||||
/**
|
||||
* Read data from the KVMFRFrame into the dst buffer
|
||||
*/
|
||||
bool framebuffer_read(const FrameBuffer frame, void * dst, size_t size);
|
||||
bool framebuffer_read(const FrameBuffer * frame, void * dst, size_t size);
|
||||
|
||||
/**
|
||||
* Read data from the KVMFRFrame using a callback
|
||||
*/
|
||||
bool framebuffer_read_fn(const FrameBuffer frame, FrameBufferReadFn fn, size_t size, void * opaque);
|
||||
bool framebuffer_read_fn(const FrameBuffer * frame, FrameBufferReadFn fn, size_t size, void * opaque);
|
||||
|
||||
/**
|
||||
* Prepare the framebuffer for writing
|
||||
*/
|
||||
void framebuffer_prepare(const FrameBuffer frame);
|
||||
void framebuffer_prepare(FrameBuffer * frame);
|
||||
|
||||
/**
|
||||
* Write data from the src buffer into the KVMFRFrame
|
||||
*/
|
||||
bool framebuffer_write(const FrameBuffer frame, const void * src, size_t size);
|
||||
bool framebuffer_write(FrameBuffer * frame, const void * src, size_t size);
|
@ -23,13 +23,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include <string.h>
|
||||
#define FB_CHUNK_SIZE 1024
|
||||
|
||||
struct stFrameBuffer
|
||||
{
|
||||
uint64_t wp;
|
||||
uint8_t data[0];
|
||||
};
|
||||
|
||||
bool framebuffer_read(const FrameBuffer frame, void * dst, size_t size)
|
||||
bool framebuffer_read(const FrameBuffer * frame, void * dst, size_t size)
|
||||
{
|
||||
uint8_t *d = (uint8_t*)dst;
|
||||
uint64_t rp = 0;
|
||||
@ -51,7 +45,7 @@ bool framebuffer_read(const FrameBuffer frame, void * dst, size_t size)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool framebuffer_read_fn(const FrameBuffer frame, FrameBufferReadFn fn, size_t size, void * opaque)
|
||||
bool framebuffer_read_fn(const FrameBuffer * frame, FrameBufferReadFn fn, size_t size, void * opaque)
|
||||
{
|
||||
uint64_t rp = 0;
|
||||
while(rp < size)
|
||||
@ -76,12 +70,12 @@ bool framebuffer_read_fn(const FrameBuffer frame, FrameBufferReadFn fn, size_t s
|
||||
/**
|
||||
* Prepare the framebuffer for writing
|
||||
*/
|
||||
void framebuffer_prepare(const FrameBuffer frame)
|
||||
void framebuffer_prepare(FrameBuffer * frame)
|
||||
{
|
||||
frame->wp = 0;
|
||||
}
|
||||
|
||||
bool framebuffer_write(FrameBuffer frame, const void * src, size_t size)
|
||||
bool framebuffer_write(FrameBuffer * frame, const void * src, size_t size)
|
||||
{
|
||||
/* copy in chunks */
|
||||
while(size)
|
||||
|
Loading…
Reference in New Issue
Block a user