fbdev output for xvideo, basic ARM build
[pcsx_rearmed.git] / plugins / dfxvideo / draw_fb.c
... / ...
CommitLineData
1/*
2 * (C) notaz, 2010
3 *
4 * This work is licensed under the terms of the GNU GPLv2 or later.
5 * See the COPYING file in the top-level directory.
6 */
7
8#define _IN_DRAW
9
10#include "externals.h"
11#include "gpu.h"
12#include "draw.h"
13#include "prim.h"
14#include "menu.h"
15#include "interp.h"
16#include "swap.h"
17
18#include "plugin_lib.h"
19
20// misc globals
21int iResX;
22int iResY;
23long lLowerpart;
24BOOL bIsFirstFrame = TRUE;
25BOOL bCheckMask = FALSE;
26unsigned short sSetMask = 0;
27unsigned long lSetMask = 0;
28int iDesktopCol = 16;
29int iShowFPS = 0;
30int iWinSize;
31int iMaintainAspect = 0;
32int iUseNoStretchBlt = 0;
33int iFastFwd = 0;
34int iFVDisplay = 0;
35PSXPoint_t ptCursorPoint[8];
36unsigned short usCursorActive = 0;
37char * pCaptionText;
38
39
40static void blit(void)
41{
42 int x = PSXDisplay.DisplayPosition.x;
43 int y = PSXDisplay.DisplayPosition.y;
44 int w = PreviousPSXDisplay.Range.x1;
45 int h = PreviousPSXDisplay.DisplayMode.y;
46 int pitch = PreviousPSXDisplay.DisplayMode.x * 2;
47 unsigned char *dest = pl_fbdev_buf;
48
49 // TODO: clear border if centering
50
51 // account for centering
52 h -= PreviousPSXDisplay.Range.y0;
53 dest += PreviousPSXDisplay.Range.y0 / 2 * pitch;
54 dest += PreviousPSXDisplay.Range.x0 * 2; // XXX
55
56 {
57 unsigned short *srcs = psxVuw + y * 1024 + x;
58 for (; h-- > 0; dest += pitch, srcs += 1024)
59 {
60 memcpy(dest, srcs, w * 2);
61 }
62 }
63}
64
65static int fbw, fbh, fb24bpp;
66
67void DoBufferSwap(void)
68{
69 static float fps_old;
70 if (PSXDisplay.DisplayMode.x == 0 || PSXDisplay.DisplayMode.y == 0)
71 return;
72
73 if (PSXDisplay.DisplayMode.x != fbw || PSXDisplay.DisplayMode.y != fbh
74 || PSXDisplay.RGB24 != fb24bpp) {
75 fbw = PSXDisplay.DisplayMode.x;
76 fbh = PSXDisplay.DisplayMode.y;
77 fb24bpp = PSXDisplay.RGB24;
78 pl_fbdev_set_mode(fbw, fbh, fb24bpp ? 24 : 16);
79 }
80
81 if (fps_cur != fps_old) {
82 printf("%2.1f\n", fps_cur);
83 fps_old = fps_cur;
84 }
85
86 blit();
87 pl_fbdev_flip();
88}
89
90void DoClearScreenBuffer(void) // CLEAR DX BUFFER
91{
92}
93
94void DoClearFrontBuffer(void) // CLEAR DX BUFFER
95{
96}
97
98static int initialize(void)
99{
100 iDesktopCol=32;
101
102 bUsingTWin=FALSE;
103 bIsFirstFrame = FALSE; // done
104
105 if(iShowFPS)
106 {
107 iShowFPS=0;
108 ulKeybits|=KEY_SHOWFPS;
109 szDispBuf[0]=0;
110 BuildDispMenu(0);
111 }
112
113 return 0;
114}
115
116unsigned long ulInitDisplay(void)
117{
118 iShowFPS=1;
119 initialize();
120
121 if (pl_fbdev_init() != 0)
122 return 0;
123
124 return 1; /* ok */
125}
126
127void CloseDisplay(void)
128{
129 CloseMenu();
130 pl_fbdev_finish();
131}
132
133void CreatePic(unsigned char * pMem)
134{
135}
136
137void DestroyPic(void)
138{
139}
140
141void HandleKey(int keycode)
142{
143}