From: Luc Verhaegen Date: Fri, 11 Mar 2011 14:02:45 +0000 (+0100) Subject: gpu: pvr: pdump: move empty back-end into pvr_pdumpfs.[ch] X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42f249a68a16fdc1047e89d5153b751eb150ff4c;p=sgx.git gpu: pvr: pdump: move empty back-end into pvr_pdumpfs.[ch] Signed-off-by: Luc Verhaegen Signed-off-by: Imre Deak --- diff --git a/pvr/Makefile b/pvr/Makefile index efb593b..69534d6 100644 --- a/pvr/Makefile +++ b/pvr/Makefile @@ -15,7 +15,7 @@ pvrsrvkm-objs := osfunc.o mmap.o module.o proc.o \ pvrsrvkm-objs-$(CONFIG_PVR_DEBUG) += pvr_debug.o pvrsrvkm-objs-$(CONFIG_DEBUG_FS) += pvr_debugfs.o pvrsrvkm-objs-$(CONFIG_PVR_TIMING) += pvr_debug.o -pvrsrvkm-objs-$(CONFIG_PVR_DEBUG_PDUMP) += pvr_pdump.o +pvrsrvkm-objs-$(CONFIG_PVR_DEBUG_PDUMP) += pvr_pdump.o pvr_pdumpfs.o pvrsrvkm-objs += $(pvrsrvkm-objs-y) $(pvrsrvkm-objs-m) diff --git a/pvr/pvr_pdump.c b/pvr/pvr_pdump.c index 1989204..b333344 100644 --- a/pvr/pvr_pdump.c +++ b/pvr/pvr_pdump.c @@ -32,7 +32,9 @@ #include "pvrversion.h" #include "sgxmmu.h" #include "mm.h" + #include "pvr_pdump.h" +#include "pvr_pdumpfs.h" /* * There is no sense in having SGX_MMU_PAGE_SIZE differ from PAGE_SIZE. @@ -53,13 +55,6 @@ static char *gpszComment; static char *gpszScript; static char *gpszFile; -#define DEBUG_MODE_DISABLED 0 -#define DEBUG_MODE_STANDARD 1 -#define DEBUG_MODE_FULL 2 - -static u32 dbgdrv_mode = DEBUG_MODE_DISABLED; -static u32 dbgdrv_frame_number; - void PDumpSuspendKM(void) { atomic_inc(&gsPDumpSuspended); @@ -75,49 +70,6 @@ static inline IMG_BOOL PDumpSuspended(void) return atomic_read(&gsPDumpSuspended) != 0; } -/* - * empty pdump backend. - */ -static void -dbgdrv_frame_set(u32 frame) -{ - dbgdrv_frame_number = frame; -} - -static enum PVRSRV_ERROR -dbgdrv_write_data(void *buffer, int size, bool from_user) -{ - return PVRSRV_OK; -} - -static void -dbgdrv_write_string(char *string) -{ - -} - -static bool -dbgdrv_capturing(void) -{ - if (dbgdrv_mode == DEBUG_MODE_FULL) - return true; - else - return false; -} - -static bool dbgdrv_flags_check(u32 flags) -{ - if (flags & PDUMP_FLAGS_NEVER) - return false; - else if (dbgdrv_mode == DEBUG_MODE_FULL) - return true; - else if ((dbgdrv_mode == DEBUG_MODE_STANDARD) && - (flags & PDUMP_FLAGS_CONTINUOUS)) - return true; - else - return false; -} - static void pdump_print(u32 flags, char *format, ...) { @@ -126,14 +78,14 @@ pdump_print(u32 flags, char *format, ...) if (PDumpSuspended()) return; - if (!dbgdrv_flags_check(flags)) + if (!pdumpfs_flags_check(flags)) return; va_start(ap, format); vsnprintf(gpszScript, SZ_SCRIPT_SIZE_MAX, format, ap); va_end(ap); - dbgdrv_write_string(gpszScript); + pdumpfs_write_string(gpszScript); } static enum PVRSRV_ERROR @@ -142,10 +94,10 @@ pdump_dump(u32 flags, void *buffer, u32 size, bool from_user) if (PDumpSuspended()) return PVRSRV_OK; - if (!dbgdrv_flags_check(flags)) + if (!pdumpfs_flags_check(flags)) return PVRSRV_OK; - return dbgdrv_write_data(buffer, size, from_user); + return pdumpfs_write_data(buffer, size, from_user); } void PDumpCommentKM(char *pszComment, u32 ui32Flags) @@ -188,7 +140,7 @@ void PDumpSetFrameKM(u32 ui32Frame) if (PDumpSuspended()) return; - dbgdrv_frame_set(ui32Frame); + pdumpfs_frame_set(ui32Frame); } IMG_BOOL PDumpIsCaptureFrameKM(void) @@ -196,7 +148,7 @@ IMG_BOOL PDumpIsCaptureFrameKM(void) if (PDumpSuspended()) return IMG_FALSE; - return dbgdrv_capturing(); + return pdumpfs_capture_enabled(); } void PDumpInit(void) diff --git a/pvr/pvr_pdumpfs.c b/pvr/pvr_pdumpfs.c new file mode 100644 index 0000000..a1a3de7 --- /dev/null +++ b/pvr/pvr_pdumpfs.c @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2010-2011 by Luc Verhaegen + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "img_defs.h" +#include "services_headers.h" +#include "pvr_pdump.h" +#include "pvr_pdumpfs.h" + +enum pdumpfs_mode { + PDUMPFS_MODE_DISABLED, + PDUMPFS_MODE_STANDARD, + PDUMPFS_MODE_FULL, +}; + +static enum pdumpfs_mode pdumpfs_mode = PDUMPFS_MODE_DISABLED; +static u32 pdumpfs_frame_number; + +void +pdumpfs_frame_set(u32 frame) +{ + pdumpfs_frame_number = frame; +} + +bool +pdumpfs_capture_enabled(void) +{ + if (pdumpfs_mode == PDUMPFS_MODE_FULL) + return true; + else + return false; +} + +bool +pdumpfs_flags_check(u32 flags) +{ + if (flags & PDUMP_FLAGS_NEVER) + return false; + else if (pdumpfs_mode == PDUMPFS_MODE_FULL) + return true; + else if ((pdumpfs_mode == PDUMPFS_MODE_STANDARD) && + (flags & PDUMP_FLAGS_CONTINUOUS)) + return true; + else + return false; +} + +enum PVRSRV_ERROR +pdumpfs_write_data(void *buffer, size_t size, bool from_user) +{ + return PVRSRV_OK; +} + +void +pdumpfs_write_string(char *string) +{ + +} diff --git a/pvr/pvr_pdumpfs.h b/pvr/pvr_pdumpfs.h new file mode 100644 index 0000000..cc5c769 --- /dev/null +++ b/pvr/pvr_pdumpfs.h @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2010 by Luc Verhaegen + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _PVR_PDUMPFS_H_ +#define _PVR_PDUMPFS_H_ + +void pdumpfs_frame_set(u32 frame); +bool pdumpfs_capture_enabled(void); +bool pdumpfs_flags_check(u32 flags); +enum PVRSRV_ERROR pdumpfs_write_data(void *buffer, size_t size, bool from_user); +void pdumpfs_write_string(char *string); + +#endif /* _PVR_PDUMPFS_H_ */