[Video] Change GrLock_t to gfxLock_t

This commit is contained in:
zilmar 2017-08-05 09:01:05 +10:00
parent 78df749e3e
commit 81fbec9e42
8 changed files with 42 additions and 22 deletions

View File

@ -222,8 +222,6 @@ extern "C" {
*******************************************************************/ *******************************************************************/
EXPORT void CALL DllTest(void * hParent); EXPORT void CALL DllTest(void * hParent);
EXPORT void CALL ReadScreen(void **dest, int *width, int *height);
/****************************************************************** /******************************************************************
Function: DrawScreen Function: DrawScreen
Purpose: This function is called when the emulator receives a Purpose: This function is called when the emulator receives a

View File

@ -1273,7 +1273,7 @@ void newSwapBuffers()
GrLfbInfo_t info; GrLfbInfo_t info;
info.size = sizeof(GrLfbInfo_t); info.size = sizeof(GrLfbInfo_t);
if (gfxLfbLock(GR_LFB_READ_ONLY, GFX_BUFFER_BACKBUFFER, GR_LFBWRITEMODE_565, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) if (gfxLfbLock(GFX_LFB_READ_ONLY, GFX_BUFFER_BACKBUFFER, GR_LFBWRITEMODE_565, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info))
{ {
AUTO_PTR<uint8_t> ssimg_buffer(new uint8_t[image_width * image_height * 3]); AUTO_PTR<uint8_t> ssimg_buffer(new uint8_t[image_width * image_height * 3]);
uint8_t * ssimg = ssimg_buffer.get(); uint8_t * ssimg = ssimg_buffer.get();
@ -1316,7 +1316,7 @@ void newSwapBuffers()
} }
} }
// Unlock the backbuffer // Unlock the backbuffer
gfxLfbUnlock(GR_LFB_READ_ONLY, GFX_BUFFER_BACKBUFFER); gfxLfbUnlock(GFX_LFB_READ_ONLY, GFX_BUFFER_BACKBUFFER);
write_png_file(path, image_width, image_height, ssimg); write_png_file(path, image_width, image_height, ssimg);
g_capture_screen = false; g_capture_screen = false;
} }

View File

@ -953,7 +953,7 @@ uint32_t gfxGet(uint32_t pname, uint32_t plength, FxI32 *params)
params[1] = 65535; params[1] = 65535;
return 8; return 8;
break; break;
case GR_LFB_PIXEL_PIPE: case GFX_LFB_PIXEL_PIPE:
if (plength < 4 || params == NULL) return 0; if (plength < 4 || params == NULL) return 0;
params[0] = FXFALSE; params[0] = FXFALSE;
return 4; return 4;
@ -1324,10 +1324,10 @@ void gfxBufferSwap(uint32_t swap_interval)
} }
// frame buffer // frame buffer
bool gfxLfbLock(GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, bool pixelPipeline, GrLfbInfo_t *info) bool gfxLfbLock(gfxLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, bool pixelPipeline, GrLfbInfo_t *info)
{ {
WriteTrace(TraceGlitch, TraceDebug, "type: %d buffer: %d writeMode: %d origin: %d pixelPipeline: %d", type, buffer, writeMode, origin, pixelPipeline); WriteTrace(TraceGlitch, TraceDebug, "type: %d buffer: %d writeMode: %d origin: %d pixelPipeline: %d", type, buffer, writeMode, origin, pixelPipeline);
if (type == GR_LFB_WRITE_ONLY) if (type == GFX_LFB_WRITE_ONLY)
{ {
WriteTrace(TraceGlitch, TraceWarning, "gfxLfbLock : write only"); WriteTrace(TraceGlitch, TraceWarning, "gfxLfbLock : write only");
} }
@ -1393,10 +1393,10 @@ bool gfxLfbLock(GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode, Gr
return FXTRUE; return FXTRUE;
} }
bool gfxLfbUnlock(GrLock_t type, GrBuffer_t buffer) bool gfxLfbUnlock(gfxLock_t type, GrBuffer_t buffer)
{ {
WriteTrace(TraceGlitch, TraceDebug, "type: %d, buffer: %d", type, buffer); WriteTrace(TraceGlitch, TraceDebug, "type: %d, buffer: %d", type, buffer);
if (type == GR_LFB_WRITE_ONLY) if (type == GFX_LFB_WRITE_ONLY)
{ {
WriteTrace(TraceGlitch, TraceWarning, "gfxLfbUnlock : write only"); WriteTrace(TraceGlitch, TraceWarning, "gfxLfbUnlock : write only");
} }
@ -1500,7 +1500,7 @@ bool gfxLfbWriteRegion(GrBuffer_t dst_buffer, uint32_t dst_x, uint32_t dst_y, Gr
const unsigned int half_stride = src_stride / 2; const unsigned int half_stride = src_stride / 2;
switch (src_format) switch (src_format)
{ {
case GR_LFB_SRC_FMT_1555: case GFX_LFB_SRC_FMT_1555:
for (j = 0; j < src_height; j++) for (j = 0; j < src_height; j++)
{ {
for (i = 0; i < src_width; i++) for (i = 0; i < src_width; i++)

View File

@ -1604,10 +1604,10 @@ void gfxBufferSwap(uint32_t swap_interval)
} }
// frame buffer // frame buffer
bool gfxLfbLock(GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, bool pixelPipeline, GrLfbInfo_t *info) bool gfxLfbLock(gfxLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, bool pixelPipeline, GrLfbInfo_t *info)
{ {
WriteTrace(TraceGlitch, TraceDebug, "type: %d buffer: %d writeMode: %d origin: %d pixelPipeline: %d", type, buffer, writeMode, origin, pixelPipeline); WriteTrace(TraceGlitch, TraceDebug, "type: %d buffer: %d writeMode: %d origin: %d pixelPipeline: %d", type, buffer, writeMode, origin, pixelPipeline);
if (type == GR_LFB_WRITE_ONLY) if (type == GFX_LFB_WRITE_ONLY)
{ {
WriteTrace(TraceGlitch, TraceWarning, "gfxLfbLock : write only"); WriteTrace(TraceGlitch, TraceWarning, "gfxLfbLock : write only");
} }
@ -1674,10 +1674,10 @@ bool gfxLfbLock(GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode, Gr
return FXTRUE; return FXTRUE;
} }
bool gfxLfbUnlock(GrLock_t type, GrBuffer_t buffer) bool gfxLfbUnlock(gfxLock_t type, GrBuffer_t buffer)
{ {
WriteTrace(TraceGlitch, TraceDebug, "type: %d, buffer: %d", type, buffer); WriteTrace(TraceGlitch, TraceDebug, "type: %d, buffer: %d", type, buffer);
if (type == GR_LFB_WRITE_ONLY) if (type == GFX_LFB_WRITE_ONLY)
{ {
WriteTrace(TraceGlitch, TraceWarning, "gfxLfbUnlock : write only"); WriteTrace(TraceGlitch, TraceWarning, "gfxLfbUnlock : write only");
} }
@ -1782,7 +1782,7 @@ bool gfxLfbWriteRegion(GrBuffer_t dst_buffer, uint32_t dst_x, uint32_t dst_y, Gr
const unsigned int half_stride = src_stride / 2; const unsigned int half_stride = src_stride / 2;
switch (src_format) switch (src_format)
{ {
case GR_LFB_SRC_FMT_1555: case GFX_LFB_SRC_FMT_1555:
for (j = 0; j < src_height; j++) for (j = 0; j < src_height; j++)
{ {
for (i = 0; i < src_width; i++) for (i = 0; i < src_width; i++)

View File

@ -57,8 +57,8 @@ uint32_t gfxGet(uint32_t pname, uint32_t plength, FxI32 *params);
void gfxRenderBuffer(GrBuffer_t buffer); void gfxRenderBuffer(GrBuffer_t buffer);
void gfxBufferClear(gfxColor_t color, gfxAlpha_t alpha, uint32_t depth); void gfxBufferClear(gfxColor_t color, gfxAlpha_t alpha, uint32_t depth);
void gfxBufferSwap(uint32_t swap_interval); void gfxBufferSwap(uint32_t swap_interval);
bool gfxLfbLock(GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, bool pixelPipeline, GrLfbInfo_t *info); bool gfxLfbLock(gfxLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, bool pixelPipeline, GrLfbInfo_t *info);
bool gfxLfbUnlock(GrLock_t type, GrBuffer_t buffer); bool gfxLfbUnlock(gfxLock_t type, GrBuffer_t buffer);
bool gfxLfbReadRegion(GrBuffer_t src_buffer, uint32_t src_x, uint32_t src_y, uint32_t src_width, uint32_t src_height, uint32_t dst_stride, void *dst_data); bool gfxLfbReadRegion(GrBuffer_t src_buffer, uint32_t src_x, uint32_t src_y, uint32_t src_width, uint32_t src_height, uint32_t dst_stride, void *dst_data);
bool gfxLfbWriteRegion(GrBuffer_t dst_buffer, uint32_t dst_x, uint32_t dst_y, GrLfbSrcFmt_t src_format, uint32_t src_width, uint32_t src_height, bool pixelPipeline, FxI32 src_stride, void *src_data); bool gfxLfbWriteRegion(GrBuffer_t dst_buffer, uint32_t dst_x, uint32_t dst_y, GrLfbSrcFmt_t src_format, uint32_t src_width, uint32_t src_height, bool pixelPipeline, FxI32 src_stride, void *src_data);
uint32_t gfxTexCalcMemRequired(gfxLOD_t lodmin, gfxLOD_t lodmax, gfxAspectRatio_t aspect, gfxTextureFormat_t fmt); uint32_t gfxTexCalcMemRequired(gfxLOD_t lodmin, gfxLOD_t lodmax, gfxAspectRatio_t aspect, gfxTextureFormat_t fmt);

View File

@ -263,6 +263,28 @@ enum gfxColorFormat_t
GFX_COLORFORMAT_BGRA = 0x3, GFX_COLORFORMAT_BGRA = 0x3,
}; };
enum gfxLock_t
{
GFX_LFB_READ_ONLY = 0x00,
GFX_LFB_WRITE_ONLY = 0x01,
GFX_LFB_IDLE = 0x00,
GFX_LFB_NOIDLE = 0x10,
};
enum gfxLfbSrcFmt_t
{
GFX_LFB_SRC_FMT_565 = 0x00,
GFX_LFB_SRC_FMT_555 = 0x01,
GFX_LFB_SRC_FMT_1555 = 0x02,
GFX_LFB_SRC_FMT_888 = 0x04,
GFX_LFB_SRC_FMT_8888 = 0x05,
GFX_LFB_SRC_FMT_565_DEPTH = 0x0c,
GFX_LFB_SRC_FMT_555_DEPTH = 0x0d,
GFX_LFB_SRC_FMT_1555_DEPTH = 0x0e,
GFX_LFB_SRC_FMT_ZA16 = 0x0f,
GFX_LFB_SRC_FMT_RLE16 = 0x80,
};
enum gfxChromakeyMode_t enum gfxChromakeyMode_t
{ {
GFX_CHROMAKEY_DISABLE = 0x0, GFX_CHROMAKEY_DISABLE = 0x0,

View File

@ -663,7 +663,7 @@ static void CopyFrameBuffer(GrBuffer_t buffer = GFX_BUFFER_BACKBUFFER)
GrLfbInfo_t info; GrLfbInfo_t info;
info.size = sizeof(GrLfbInfo_t); info.size = sizeof(GrLfbInfo_t);
if (gfxLfbLock(GR_LFB_READ_ONLY, if (gfxLfbLock(GFX_LFB_READ_ONLY,
buffer, buffer,
GR_LFBWRITEMODE_565, GR_LFBWRITEMODE_565,
GR_ORIGIN_UPPER_LEFT, GR_ORIGIN_UPPER_LEFT,
@ -702,7 +702,7 @@ static void CopyFrameBuffer(GrBuffer_t buffer = GFX_BUFFER_BACKBUFFER)
} }
// Unlock the backbuffer // Unlock the backbuffer
gfxLfbUnlock(GR_LFB_READ_ONLY, buffer); gfxLfbUnlock(GFX_LFB_READ_ONLY, buffer);
WriteTrace(TraceRDP, TraceDebug, "LfbLock. Framebuffer copy complete."); WriteTrace(TraceRDP, TraceDebug, "LfbLock. Framebuffer copy complete.");
} }
else else
@ -2970,7 +2970,7 @@ void rdp_setcolorimage()
ptr_dst[x + y * width] = c; ptr_dst[x + y * width] = c;
} }
} }
gfxLfbWriteRegion(GFX_BUFFER_BACKBUFFER, (uint32_t)rdp.offset_x, (uint32_t)rdp.offset_y, GR_LFB_SRC_FMT_555, width, height, FXFALSE, width << 1, ptr_dst); gfxLfbWriteRegion(GFX_BUFFER_BACKBUFFER, (uint32_t)rdp.offset_x, (uint32_t)rdp.offset_y, GFX_LFB_SRC_FMT_555, width, height, FXFALSE, width << 1, ptr_dst);
delete[] ptr_dst; delete[] ptr_dst;
} }
} }

View File

@ -234,7 +234,7 @@ void DrawDepthImage(const DRAWIMAGE & d)
dst[x + y*dst_width] = src[(int(x*scale_x_src) + int(y*scale_y_src)*src_width) ^ 1]; dst[x + y*dst_width] = src[(int(x*scale_x_src) + int(y*scale_y_src)*src_width) ^ 1];
} }
} }
gfxLfbWriteRegion(GFX_BUFFER_AUXBUFFER, 0, 0, GR_LFB_SRC_FMT_ZA16, dst_width, dst_height, FXFALSE, dst_width << 1, dst); gfxLfbWriteRegion(GFX_BUFFER_AUXBUFFER, 0, 0, GFX_LFB_SRC_FMT_ZA16, dst_width, dst_height, FXFALSE, dst_width << 1, dst);
delete[] dst; delete[] dst;
} }