From e74c1b6efadc432fa2dc5e6017b538f8a8831961 Mon Sep 17 00:00:00 2001 From: Matt Sealey Date: Wed, 28 Nov 2012 14:24:21 -0800 Subject: [PATCH] amd-gpu: move includes into the driver root directory * add #include statements where necessary to build. Some of this is a bit hacky. * fix some things along the way (register defs mmCP_RB_RPTR -> REG_CP_RB_RPTR) * move klibapi prototypes into the includes for those subsystems * delete tbdump etc. includes * delete unreferenced includes that would be touched by userspace using them (not) --- drivers/mxc/amd-gpu/{include => }/g12_reg.h | 0 .../mxc/amd-gpu/include/api/gsl_displayapi.h | 74 ----------- drivers/mxc/amd-gpu/include/api/gsl_klibapi.h | 121 ------------------ drivers/mxc/amd-gpu/include/api/gsl_libapi.h | 104 --------------- drivers/mxc/amd-gpu/include/api/gsl_utils.h | 43 ------- drivers/mxc/amd-gpu/include/gsl.h | 71 ---------- drivers/mxc/amd-gpu/include/gsl_debug.h | 113 ---------------- drivers/mxc/amd-gpu/include/gsl_tbdump.h | 38 ------ .../gsl_buildconfig.h => kgsl_buildconfig.h} | 10 -- drivers/mxc/amd-gpu/kgsl_cmdstream.c | 15 ++- .../gsl_cmdstream.h => kgsl_cmdstream.h} | 10 ++ drivers/mxc/amd-gpu/kgsl_cmdwindow.c | 13 +- .../gsl_cmdwindow.h => kgsl_cmdwindow.h} | 0 .../{include/gsl_config.h => kgsl_config.h} | 7 + drivers/mxc/amd-gpu/kgsl_context.c | 18 ++- .../{include/gsl_display.h => kgsl_debug.h} | 51 ++++---- drivers/mxc/amd-gpu/kgsl_device.c | 17 ++- .../{include/gsl_device.h => kgsl_device.h} | 24 ++++ drivers/mxc/amd-gpu/kgsl_drawctxt.c | 20 ++- .../gsl_drawctxt.h => kgsl_drawctxt.h} | 8 ++ drivers/mxc/amd-gpu/kgsl_driver.c | 14 +- .../{include/gsl_driver.h => kgsl_driver.h} | 10 ++ drivers/mxc/amd-gpu/kgsl_g12.c | 12 +- .../{include => }/kgsl_g12_vgv3types.h | 0 drivers/mxc/amd-gpu/kgsl_hal.c | 12 +- .../amd-gpu/{include/gsl_hal.h => kgsl_hal.h} | 6 +- .../gsl_halconfig.h => kgsl_halconfig.h} | 0 .../gsl_hwaccess.h => kgsl_hwaccess.h} | 3 +- drivers/mxc/amd-gpu/kgsl_intrmgr.c | 8 +- .../{include/gsl_intrmgr.h => kgsl_intrmgr.h} | 4 + .../{include/gsl_ioctl.h => kgsl_ioctl.h} | 4 +- drivers/mxc/amd-gpu/kgsl_kmod.c | 28 ++-- drivers/mxc/amd-gpu/kgsl_kmod_cleanup.c | 8 +- drivers/mxc/amd-gpu/kgsl_kmod_cleanup.h | 3 +- drivers/mxc/amd-gpu/kgsl_linux_map.c | 2 +- .../gsl_linux_map.h => kgsl_linux_map.h} | 2 - .../amd-gpu/{include/gsl_log.h => kgsl_log.h} | 0 drivers/mxc/amd-gpu/kgsl_memmgr.c | 6 +- .../{include/gsl_memmgr.h => kgsl_memmgr.h} | 0 drivers/mxc/amd-gpu/kgsl_mmu.c | 10 +- .../amd-gpu/{include/gsl_mmu.h => kgsl_mmu.h} | 2 + .../api/gsl_pm4types.h => kgsl_pm4types.h} | 0 .../gsl_properties.h => kgsl_properties.h} | 1 + drivers/mxc/amd-gpu/kgsl_pwrctrl.c | 7 +- drivers/mxc/amd-gpu/kgsl_ringbuffer.c | 16 ++- .../gsl_ringbuffer.h => kgsl_ringbuffer.h} | 14 +- drivers/mxc/amd-gpu/kgsl_sharedmem.c | 8 +- .../gsl_sharedmem.h => kgsl_sharedmem.h} | 15 +++ .../{include/api/gsl_types.h => kgsl_types.h} | 2 + drivers/mxc/amd-gpu/kgsl_yamato.c | 14 +- .../mxc/amd-gpu/{include => }/yamato_reg.h | 1 - 51 files changed, 296 insertions(+), 673 deletions(-) rename drivers/mxc/amd-gpu/{include => }/g12_reg.h (100%) delete mode 100644 drivers/mxc/amd-gpu/include/api/gsl_displayapi.h delete mode 100644 drivers/mxc/amd-gpu/include/api/gsl_klibapi.h delete mode 100644 drivers/mxc/amd-gpu/include/api/gsl_libapi.h delete mode 100644 drivers/mxc/amd-gpu/include/api/gsl_utils.h delete mode 100644 drivers/mxc/amd-gpu/include/gsl.h delete mode 100644 drivers/mxc/amd-gpu/include/gsl_debug.h delete mode 100644 drivers/mxc/amd-gpu/include/gsl_tbdump.h rename drivers/mxc/amd-gpu/{include/gsl_buildconfig.h => kgsl_buildconfig.h} (88%) rename drivers/mxc/amd-gpu/{include/gsl_cmdstream.h => kgsl_cmdstream.h} (71%) rename drivers/mxc/amd-gpu/{include/gsl_cmdwindow.h => kgsl_cmdwindow.h} (100%) rename drivers/mxc/amd-gpu/{include/gsl_config.h => kgsl_config.h} (96%) rename drivers/mxc/amd-gpu/{include/gsl_display.h => kgsl_debug.h} (64%) rename drivers/mxc/amd-gpu/{include/gsl_device.h => kgsl_device.h} (81%) rename drivers/mxc/amd-gpu/{include/gsl_drawctxt.h => kgsl_drawctxt.h} (90%) rename drivers/mxc/amd-gpu/{include/gsl_driver.h => kgsl_driver.h} (88%) rename drivers/mxc/amd-gpu/{include => }/kgsl_g12_vgv3types.h (100%) rename drivers/mxc/amd-gpu/{include/gsl_hal.h => kgsl_hal.h} (98%) rename drivers/mxc/amd-gpu/{include/gsl_halconfig.h => kgsl_halconfig.h} (100%) rename drivers/mxc/amd-gpu/{include/gsl_hwaccess.h => kgsl_hwaccess.h} (97%) rename drivers/mxc/amd-gpu/{include/gsl_intrmgr.h => kgsl_intrmgr.h} (97%) rename drivers/mxc/amd-gpu/{include/gsl_ioctl.h => kgsl_ioctl.h} (99%) rename drivers/mxc/amd-gpu/{include/gsl_linux_map.h => kgsl_linux_map.h} (98%) rename drivers/mxc/amd-gpu/{include/gsl_log.h => kgsl_log.h} (100%) rename drivers/mxc/amd-gpu/{include/gsl_memmgr.h => kgsl_memmgr.h} (100%) rename drivers/mxc/amd-gpu/{include/gsl_mmu.h => kgsl_mmu.h} (98%) rename drivers/mxc/amd-gpu/{include/api/gsl_pm4types.h => kgsl_pm4types.h} (100%) rename drivers/mxc/amd-gpu/{include/api/gsl_properties.h => kgsl_properties.h} (99%) rename drivers/mxc/amd-gpu/{include/gsl_ringbuffer.h => kgsl_ringbuffer.h} (96%) rename drivers/mxc/amd-gpu/{include/gsl_sharedmem.h => kgsl_sharedmem.h} (76%) rename drivers/mxc/amd-gpu/{include/api/gsl_types.h => kgsl_types.h} (99%) rename drivers/mxc/amd-gpu/{include => }/yamato_reg.h (99%) diff --git a/drivers/mxc/amd-gpu/include/g12_reg.h b/drivers/mxc/amd-gpu/g12_reg.h similarity index 100% rename from drivers/mxc/amd-gpu/include/g12_reg.h rename to drivers/mxc/amd-gpu/g12_reg.h diff --git a/drivers/mxc/amd-gpu/include/api/gsl_displayapi.h b/drivers/mxc/amd-gpu/include/api/gsl_displayapi.h deleted file mode 100644 index aa770b3e143..00000000000 --- a/drivers/mxc/amd-gpu/include/api/gsl_displayapi.h +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright (c) 2008-2010, Code Aurora Forum. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Code Aurora Forum nor - * the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef __GSL_DISPLAYAPI_H -#define __GSL_DISPLAYAPI_H - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -// defines -#define GSL_DISPLAY_PANEL_TOSHIBA_640x480 0 -#define GSL_DISPLAY_PANEL_HITACHI_240x320 1 -#define GSL_DISPLAY_PANEL_DEFAULT GSL_DISPLAY_PANEL_TOSHIBA_640x480 - - -////////////////////////////////////////////////////////////////////////////// -// types -////////////////////////////////////////////////////////////////////////////// -typedef int gsl_display_id_t; -typedef int gsl_surface_id_t; - -typedef struct _gsl_displaymode_t { - int panel_id; - int width; - int height; - int bpp; - int orientation; - int frequency; -} gsl_displaymode_t; - - -////////////////////////////////////////////////////////////////////////////// -// prototypes -////////////////////////////////////////////////////////////////////////////// -extern gsl_display_id_t gsl_display_open(gsl_devhandle_t devhandle, int panel_id); -extern int gsl_display_close(gsl_display_id_t display_id); -extern int gsl_display_getcount(void); -extern int gsl_display_setmode(gsl_display_id_t display_id, gsl_displaymode_t displaymode); -extern int gsl_display_getmode(gsl_display_id_t display_id, gsl_displaymode_t *displaymode); -extern gsl_surface_id_t gsl_display_setsurface(gsl_display_id_t display_id, void *buffer); -extern int gsl_display_getactivesurface(gsl_display_id_t display_id, void **buffer); -extern int gsl_display_flipsurface(gsl_display_id_t display_id, gsl_surface_id_t surface_id); - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // __GSL_DISPLAYAPI_H diff --git a/drivers/mxc/amd-gpu/include/api/gsl_klibapi.h b/drivers/mxc/amd-gpu/include/api/gsl_klibapi.h deleted file mode 100644 index ffaf2a260ca..00000000000 --- a/drivers/mxc/amd-gpu/include/api/gsl_klibapi.h +++ /dev/null @@ -1,121 +0,0 @@ -/* Copyright (c) 2008-2010, Code Aurora Forum. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Code Aurora Forum nor - * the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef __GSL_KLIBAPI_H -#define __GSL_KLIBAPI_H - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -#include "gsl_types.h" -#include "gsl_properties.h" - -////////////////////////////////////////////////////////////////////////////// -// version control -////////////////////////////////////////////////////////////////////////////// -#define KGSLLIB_NAME "AMD GSL Kernel Library" -#define KGSLLIB_VERSION "0.1" - - -////////////////////////////////////////////////////////////////////////////// -// library API -////////////////////////////////////////////////////////////////////////////// -int kgsl_driver_init(void); -int kgsl_driver_close(void); -int kgsl_driver_entry(gsl_flags_t flags); -int kgsl_driver_exit(void); -int kgsl_driver_destroy(unsigned int pid); - - -//////////////////////////////////////////////////////////////////////////// -// device API -//////////////////////////////////////////////////////////////////////////// -int kgsl_device_start(unsigned int device_id, gsl_flags_t flags); -int kgsl_device_stop(unsigned int device_id); -int kgsl_device_idle(unsigned int device_id, unsigned int timeout); -int kgsl_device_isidle(unsigned int device_id); -int kgsl_device_getproperty(unsigned int device_id, gsl_property_type_t type, void *value, unsigned int sizebytes); -int kgsl_device_setproperty(unsigned int device_id, gsl_property_type_t type, void *value, unsigned int sizebytes); -int kgsl_device_regread(unsigned int device_id, unsigned int offsetwords, unsigned int *value); -int kgsl_device_regwrite(unsigned int device_id, unsigned int offsetwords, unsigned int value); -int kgsl_device_waitirq(unsigned int device_id, gsl_intrid_t intr_id, unsigned int *count, unsigned int timeout); - - -//////////////////////////////////////////////////////////////////////////// -// command API -//////////////////////////////////////////////////////////////////////////// -int kgsl_cmdstream_issueibcmds(unsigned int device_id, int drawctxt_index, uint32_t ibaddr, int sizedwords, unsigned int *timestamp, gsl_flags_t flags); -unsigned int kgsl_cmdstream_readtimestamp(unsigned int device_id, enum kgsl_timestamp_type type); -int kgsl_cmdstream_freememontimestamp(unsigned int device_id, struct kgsl_memdesc *memdesc, unsigned int timestamp, enum kgsl_timestamp_type type); -int kgsl_cmdstream_waittimestamp(unsigned int device_id, unsigned int timestamp, unsigned int timeout); -int kgsl_cmdwindow_write(unsigned int device_id, enum kgsl_cmdwindow_type target, unsigned int addr, unsigned int data); -int kgsl_add_timestamp(unsigned int device_id, unsigned int *timestamp); -int kgsl_cmdstream_check_timestamp(unsigned int device_id, unsigned int timestamp); - -//////////////////////////////////////////////////////////////////////////// -// context API -//////////////////////////////////////////////////////////////////////////// -int kgsl_context_create(unsigned int device_id, gsl_context_type_t type, unsigned int *drawctxt_id, gsl_flags_t flags); -int kgsl_context_destroy(unsigned int device_id, unsigned int drawctxt_id); -int kgsl_drawctxt_bind_gmem_shadow(unsigned int device_id, unsigned int drawctxt_id, const struct kgsl_gmem_desc* gmem_rect, unsigned int shadow_x, unsigned int shadow_y, const struct kgsl_buffer_desc* shadow_buffer, unsigned int buffer_id); - - -//////////////////////////////////////////////////////////////////////////// -// sharedmem API -//////////////////////////////////////////////////////////////////////////// -int kgsl_sharedmem_alloc(unsigned int device_id, gsl_flags_t flags, int sizebytes, struct kgsl_memdesc *memdesc); -int kgsl_sharedmem_free(struct kgsl_memdesc *memdesc); -int kgsl_sharedmem_read(const struct kgsl_memdesc *memdesc, void *dst, unsigned int offsetbytes, unsigned int sizebytes, unsigned int touserspace); -int kgsl_sharedmem_write(const struct kgsl_memdesc *memdesc, unsigned int offsetbytes, void *src, unsigned int sizebytes, unsigned int fromuserspace); -int kgsl_sharedmem_set(const struct kgsl_memdesc *memdesc, unsigned int offsetbytes, unsigned int value, unsigned int sizebytes); -unsigned int kgsl_sharedmem_largestfreeblock(unsigned int device_id, gsl_flags_t flags); -int kgsl_sharedmem_map(unsigned int device_id, gsl_flags_t flags, const gsl_scatterlist_t *scatterlist, struct kgsl_memdesc *memdesc); -int kgsl_sharedmem_unmap(struct kgsl_memdesc *memdesc); -int kgsl_sharedmem_getmap(const struct kgsl_memdesc *memdesc, gsl_scatterlist_t *scatterlist); -int kgsl_sharedmem_cacheoperation(const struct kgsl_memdesc *memdesc, unsigned int offsetbytes, unsigned int sizebytes, unsigned int operation); -int kgsl_sharedmem_fromhostpointer(unsigned int device_id, struct kgsl_memdesc *memdesc, void* hostptr); - - -//////////////////////////////////////////////////////////////////////////// -// interrupt API -//////////////////////////////////////////////////////////////////////////// -void kgsl_intr_isr(struct kgsl_device *device); - - -//////////////////////////////////////////////////////////////////////////// -// TB dump API -//////////////////////////////////////////////////////////////////////////// -int kgsl_tbdump_waitirq(void); -int kgsl_tbdump_exportbmp(const void* addr, unsigned int format, unsigned int stride, unsigned int width, unsigned int height); - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // __GSL_KLIBAPI_H diff --git a/drivers/mxc/amd-gpu/include/api/gsl_libapi.h b/drivers/mxc/amd-gpu/include/api/gsl_libapi.h deleted file mode 100644 index a641c262c94..00000000000 --- a/drivers/mxc/amd-gpu/include/api/gsl_libapi.h +++ /dev/null @@ -1,104 +0,0 @@ -/* Copyright (c) 2008-2010, Code Aurora Forum. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Code Aurora Forum nor - * the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef __GSL_LIBAPI_H -#define __GSL_LIBAPI_H - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -#include "gsl_types.h" - -// defines -#define GSLLIB_NAME "AMD GSL User Library" -#define GSLLIB_VERSION "0.1" - - -// libary API -int gsl_library_open(gsl_flags_t flags); -int gsl_library_close(void); - - -// device API -gsl_devhandle_t gsl_device_open(unsigned int device_id, gsl_flags_t flags); -int gsl_device_close(gsl_devhandle_t devhandle); -int gsl_device_idle(gsl_devhandle_t devhandle, unsigned int timeout); -int gsl_device_isidle(gsl_devhandle_t devhandle); -int gsl_device_getcount(void); -int gsl_device_getinfo(gsl_devhandle_t devhandle, struct kgsl_devinfo *devinfo); -int gsl_device_setpowerstate(gsl_devhandle_t devhandle, gsl_flags_t flags); -int gsl_device_setdmistate(gsl_devhandle_t devhandle, gsl_flags_t flags); -int gsl_device_waitirq(gsl_devhandle_t devhandle, gsl_intrid_t intr_id, unsigned int *count, unsigned int timeout); -int gsl_device_waittimestamp(gsl_devhandle_t devhandle, unsigned int timestamp, unsigned int timeout); -int gsl_device_addtimestamp(gsl_devhandle_t devhandle, unsigned int *timestamp); - -// direct register API -int gsl_register_read(gsl_devhandle_t devhandle, unsigned int offsetwords, unsigned int *data); - - -// command API -int gsl_cp_issueibcommands(gsl_devhandle_t devhandle, gsl_ctxthandle_t ctxthandle, uint32_t ibaddr, unsigned int sizewords, unsigned int *timestamp, gsl_flags_t flags); -unsigned int gsl_cp_readtimestamp(gsl_devhandle_t devhandle, enum kgsl_timestamp_type type); -int gsl_cp_checktimestamp(gsl_devhandle_t devhandle, unsigned int timestamp, enum kgsl_timestamp_type type); -int gsl_cp_freememontimestamp(gsl_devhandle_t devhandle, gsl_memdesc_t *memdesc, unsigned int timestamp, enum kgsl_timestamp_type type); -int gsl_v3_issuecommand(gsl_devhandle_t devhandle, enum kgsl_cmdwindow_type target, unsigned int addr, unsigned int data); - -// context API -gsl_ctxthandle_t gsl_context_create(gsl_devhandle_t devhandle, gsl_context_type_t type, gsl_flags_t flags); -int gsl_context_destroy(gsl_devhandle_t devhandle, gsl_ctxthandle_t ctxthandle); -int gsl_context_bind_gmem_shadow(gsl_devhandle_t devhandle, gsl_ctxthandle_t ctxthandle, const kgsl_gmem_desc* gmem_rect, unsigned int shadow_x, unsigned int shadow_y, const struct kgsl_buffer_desc* shadow_buffer, unsigned int buffer_id); - - -// sharedmem API -int gsl_memory_alloc(unsigned int device_id, unsigned int sizebytes, gsl_flags_t flags, gsl_memdesc_t *memdesc); -int gsl_memory_free(gsl_memdesc_t *memdesc); -int gsl_memory_read(const gsl_memdesc_t *memdesc, void *dst, unsigned int sizebytes, unsigned int offsetbytes); -int gsl_memory_write(const gsl_memdesc_t *memdesc, void *src, unsigned int sizebytes, unsigned int offsetbytes); -int gsl_memory_write_multiple(const gsl_memdesc_t *memdesc, void *src, unsigned int srcstridebytes, unsigned int dststridebytes, unsigned int blocksizebytes, unsigned int numblocks, unsigned int offsetbytes); -unsigned int gsl_memory_getlargestfreeblock(unsigned int device_id, gsl_flags_t flags); -int gsl_memory_set(const gsl_memdesc_t *memdesc, unsigned int offsetbytes, unsigned int value, unsigned int sizebytes); -int gsl_memory_cacheoperation(const gsl_memdesc_t *memdesc, unsigned int offsetbytes, unsigned int sizebytes, unsigned int operation); -int gsl_memory_fromhostpointer(unsigned int device_id, gsl_memdesc_t *memdesc, void* hostptr); - -#ifdef _DIRECT_MAPPED -unsigned int gsl_sharedmem_gethostaddr(const gsl_memdesc_t *memdesc); -#endif // _DIRECT_MAPPED - -// address translation API -int gsl_translate_physaddr(void* virtAddr, unsigned int* physAddr); - -// TB dump API -int gsl_tbdump_waitirq(); -int gsl_tbdump_exportbmp(const void* addr, unsigned int format, unsigned int stride, unsigned int width, unsigned int height); - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // __GSL_LIBAPI_H diff --git a/drivers/mxc/amd-gpu/include/api/gsl_utils.h b/drivers/mxc/amd-gpu/include/api/gsl_utils.h deleted file mode 100644 index 1078b634173..00000000000 --- a/drivers/mxc/amd-gpu/include/api/gsl_utils.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (c) 2008-2010, Code Aurora Forum. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Code Aurora Forum nor - * the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef __GSL_UTILS_H -#define __GSL_UTILS_H - - -////////////////////////////////////////////////////////////////////////////// -// macros -////////////////////////////////////////////////////////////////////////////// -#define GSL_QUADPOW2_TO_SIZEBYTES(quadpow2) (8 << (quadpow2)) -#define GSL_QUADPOW2_TO_SIZEDWORDS(quadpow2) (2 << (quadpow2)) -#define GSL_POW2TEST(size) ((size) && !((size) & ((size) - 1))) -#define GSL_POW2ALIGN_DOWN(addr, alignsize) ((addr) & ~((alignsize) - 1)); -#define GSL_POW2ALIGN_UP(addr, alignsize) (((addr) + ((alignsize) - 1)) & ~((alignsize) - 1)) - - -#endif // __GSL_UTILS_H diff --git a/drivers/mxc/amd-gpu/include/gsl.h b/drivers/mxc/amd-gpu/include/gsl.h deleted file mode 100644 index 1e4a3c0288e..00000000000 --- a/drivers/mxc/amd-gpu/include/gsl.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright (c) 2008-2010, Code Aurora Forum. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Code Aurora Forum nor - * the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef __GSL_H -#define __GSL_H - -#define __KERNEL_MODE__ - - -struct kgsl_device; - - -////////////////////////////////////////////////////////////////////////////// -// includes -////////////////////////////////////////////////////////////////////////////// -#include "gsl_buildconfig.h" - -#include "gsl_klibapi.h" - -// Z430 -#include -#include "gsl_pm4types.h" -#include "gsl_utils.h" -#include "gsl_drawctxt.h" -#include "gsl_ringbuffer.h" - -// Z160/Z180 -#include -#include "gsl_cmdwindow.h" - -#include "gsl_debug.h" -#include "gsl_mmu.h" -#include "gsl_memmgr.h" -#include "gsl_sharedmem.h" -#include "gsl_intrmgr.h" -#include "gsl_cmdstream.h" -#include "gsl_device.h" -#include "gsl_driver.h" -#include "gsl_log.h" - -#include "gsl_config.h" - - -#define DEBUG_ASSERT(x) - -#endif // __GSL_H diff --git a/drivers/mxc/amd-gpu/include/gsl_debug.h b/drivers/mxc/amd-gpu/include/gsl_debug.h deleted file mode 100644 index 3904ea5f2f9..00000000000 --- a/drivers/mxc/amd-gpu/include/gsl_debug.h +++ /dev/null @@ -1,113 +0,0 @@ -/* Copyright (c) 2008-2010, Advanced Micro Devices. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Advanced Micro Devices nor - * the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef __GSL_DEBUG_H -#define __GSL_DEBUG_H - -#ifdef BB_DUMPX -#include "dumpx.h" -#endif - -#ifdef TBDUMP -#include "gsl_tbdump.h" -#endif - - -////////////////////////////////////////////////////////////////////////////// -// macros -////////////////////////////////////////////////////////////////////////////// -#ifdef _DEBUG -#define KGSL_DEBUG(flag, action) if (gsl_driver.flags_debug & flag) {action;} - -#define KGSL_DEBUG_DUMPPM4(cmds, sizedwords) Yamato_DumpPM4((cmds), (sizedwords)) -#define KGSL_DEBUG_DUMPREGWRITE(addr, value) Yamato_DumpRegisterWrite((addr), (value)) -#define KGSL_DEBUG_DUMPMEMWRITE(addr, sizebytes, data) Yamato_DumpWriteMemory(addr, sizebytes, data) -#define KGSL_DEBUG_DUMPMEMSET(addr, sizebytes, value) Yamato_DumpSetMemory(addr, sizebytes, value) -#define KGSL_DEBUG_DUMPFBSTART(device) Yamato_DumpFbStart(device) -#define KGSL_DEBUG_DUMPREGSPACE(device) Yamato_DumpRegSpace(device) -#define KGSL_DEBUG_DUMPWINDOW(addr, width, height) Yamato_DumpWindow(addr, width, height) - -#ifdef TBDUMP - -#define KGSL_DEBUG_TBDUMP_OPEN(filename) tbdump_open(filename) -#define KGSL_DEBUG_TBDUMP_CLOSE() tbdump_close() -#define KGSL_DEBUG_TBDUMP_SYNCMEM(addr, src, sizebytes) tbdump_syncmem((unsigned int)addr, (unsigned int)src, sizebytes) -#define KGSL_DEBUG_TBDUMP_SETMEM(addr, value, sizebytes) tbdump_setmem((unsigned int)addr, value, sizebytes) -#define KGSL_DEBUG_TBDUMP_SLAVEWRITE(addr, value) tbdump_slavewrite(addr, value) -#define KGSL_DEBUG_TBDUMP_WAITIRQ() tbdump_waitirq() - -#else -#define KGSL_DEBUG_TBDUMP_OPEN(file) -#define KGSL_DEBUG_TBDUMP_CLOSE() -#define KGSL_DEBUG_TBDUMP_SYNCMEM(addr, src, sizebytes) -#define KGSL_DEBUG_TBDUMP_SETMEM(addr, value, sizebytes) -#define KGSL_DEBUG_TBDUMP_SLAVEWRITE(addr, value) -#define KGSL_DEBUG_TBDUMP_WAITIRQ() -#endif -#ifdef BB_DUMPX -#define KGSL_DEBUG_DUMPX_OPEN(filename, param) dumpx_open((filename), (param)) -#define KGSL_DEBUG_DUMPX(cmd, par1, par2, par3, comment) dumpx(cmd, (par1), (par2), (par3), (comment)) -#define KGSL_DEBUG_DUMPX_CLOSE() dumpx_close() -#else -#define KGSL_DEBUG_DUMPX_OPEN(filename, param) -#define KGSL_DEBUG_DUMPX(cmd, par1, par2, par3, comment) -#define KGSL_DEBUG_DUMPX_CLOSE() -#endif -#else -#define KGSL_DEBUG(flag, action) -#define KGSL_DEBUG_DUMPPM4(cmds, sizedwords) -#define KGSL_DEBUG_DUMPREGWRITE(addr, value) -#define KGSL_DEBUG_DUMPMEMWRITE(addr, sizebytes, data) -#define KGSL_DEBUG_DUMPMEMSET(addr, sizebytes, value) -#define KGSL_DEBUG_DUMPFBSTART(device) -#define KGSL_DEBUG_DUMPREGSPACE(device) -#define KGSL_DEBUG_DUMPWINDOW(addr, width, height) -#define KGSL_DEBUG_DUMPX(cmd, par1, par2, par3, comment) - -#define KGSL_DEBUG_TBDUMP_OPEN(file) -#define KGSL_DEBUG_TBDUMP_CLOSE() -#define KGSL_DEBUG_TBDUMP_SYNCMEM(addr, src, sizebytes) -#define KGSL_DEBUG_TBDUMP_SETMEM(addr, value, sizebytes) -#define KGSL_DEBUG_TBDUMP_SLAVEWRITE(addr, value) -#define KGSL_DEBUG_TBDUMP_WAITIRQ() -#endif // _DEBUG - - -////////////////////////////////////////////////////////////////////////////// -// prototypes -////////////////////////////////////////////////////////////////////////////// -void Yamato_DumpPM4(unsigned int *cmds, unsigned int sizedwords); -void Yamato_DumpRegisterWrite(unsigned int dwAddress, unsigned int value); -void Yamato_DumpWriteMemory(unsigned int dwAddress, unsigned int dwSize, void* pData); -void Yamato_DumpSetMemory(unsigned int dwAddress, unsigned int dwSize, unsigned int pData); -void Yamato_DumpFbStart(struct kgsl_device *device); -void Yamato_DumpRegSpace(struct kgsl_device *device); -#ifdef _DEBUG -int kgsl_dumpx_parse_ibs(uint32_t gpuaddr, int sizedwords); -#endif //_DEBUG -#endif // __GSL_DRIVER_H diff --git a/drivers/mxc/amd-gpu/include/gsl_tbdump.h b/drivers/mxc/amd-gpu/include/gsl_tbdump.h deleted file mode 100644 index 53b30a8442e..00000000000 --- a/drivers/mxc/amd-gpu/include/gsl_tbdump.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (c) 2008-2010, Code Aurora Forum. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Code Aurora Forum nor - * the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef __GSL_TBDUMP_H -#define __GSL_TBDUMP_H - -void tbdump_open(char* filename); -void tbdump_close(); -void tbdump_syncmem(unsigned int addr, unsigned int src, unsigned int sizebytes); -void tbdump_setmem(unsigned int addr, unsigned int value, unsigned int sizebytes); -void tbdump_slavewrite(unsigned int addr, unsigned int value); - -#endif // __GSL_TBDUMP_H diff --git a/drivers/mxc/amd-gpu/include/gsl_buildconfig.h b/drivers/mxc/amd-gpu/kgsl_buildconfig.h similarity index 88% rename from drivers/mxc/amd-gpu/include/gsl_buildconfig.h rename to drivers/mxc/amd-gpu/kgsl_buildconfig.h index e70c89608d4..e0262eb8c52 100644 --- a/drivers/mxc/amd-gpu/include/gsl_buildconfig.h +++ b/drivers/mxc/amd-gpu/kgsl_buildconfig.h @@ -33,16 +33,6 @@ #ifndef __GSL__BUILDCONFIG_H #define __GSL__BUILDCONFIG_H -#define GSL_STATS_MEM -#define GSL_STATS_RINGBUFFER -#define GSL_STATS_MMU - -#define GSL_RB_USE_MEM_RPTR -#define GSL_RB_USE_MEM_TIMESTAMP -#define GSL_RB_TIMESTAMP_INTERUPT -/* #define GSL_RB_USE_WPTR_POLLING */ - #define GSL_CALLER_PROCESS_MAX 64 -#define GSL_SHMEM_MAX_APERTURES 2 #endif /* __GSL__BUILDCONFIG_H */ diff --git a/drivers/mxc/amd-gpu/kgsl_cmdstream.c b/drivers/mxc/amd-gpu/kgsl_cmdstream.c index 29bf58638c8..5e3d8842022 100644 --- a/drivers/mxc/amd-gpu/kgsl_cmdstream.c +++ b/drivers/mxc/amd-gpu/kgsl_cmdstream.c @@ -19,10 +19,19 @@ #include #include -#include "gsl.h" -#include "gsl_hal.h" -#include "gsl_cmdstream.h" +#include "kgsl_types.h" +#include "kgsl_mmu.h" +#include "kgsl_buildconfig.h" +//#include "kgsl_properties.h" +#include "kgsl_device.h" +#include "kgsl_driver.h" +#include "kgsl_linux_map.h" +#include "kgsl_halconfig.h" +#include "kgsl_hal.h" +#include "kgsl_cmdstream.h" #include "kgsl_g12_vgv3types.h" +#include "kgsl_log.h" + // functions diff --git a/drivers/mxc/amd-gpu/include/gsl_cmdstream.h b/drivers/mxc/amd-gpu/kgsl_cmdstream.h similarity index 71% rename from drivers/mxc/amd-gpu/include/gsl_cmdstream.h rename to drivers/mxc/amd-gpu/kgsl_cmdstream.h index ef96e35ebb6..87c83b6c90a 100644 --- a/drivers/mxc/amd-gpu/include/gsl_cmdstream.h +++ b/drivers/mxc/amd-gpu/kgsl_cmdstream.h @@ -29,6 +29,8 @@ #ifndef __GSL_CMDSTREAM_H #define __GSL_CMDSTREAM_H +#include "kgsl_device.h" + #define GSL_CMDSTREAM_GET_SOP_TIMESTAMP(device, data) kgsl_sharedmem_read0(&device->memstore, (data), GSL_DEVICE_MEMSTORE_OFFSET(soptimestamp), 4, false) #define GSL_CMDSTREAM_GET_EOP_TIMESTAMP(device, data) kgsl_sharedmem_read0(&device->memstore, (data), GSL_DEVICE_MEMSTORE_OFFSET(eoptimestamp), 4, false) @@ -37,4 +39,12 @@ void kgsl_cmdstream_memqueue_drain(struct kgsl_device *device); int kgsl_cmdstream_init(struct kgsl_device *device); int kgsl_cmdstream_close(struct kgsl_device *device); +int kgsl_cmdstream_issueibcmds(unsigned int device_id, int drawctxt_index, uint32_t ibaddr, int sizedwords, unsigned int *timestamp, gsl_flags_t flags); +unsigned int kgsl_cmdstream_readtimestamp(unsigned int device_id, enum kgsl_timestamp_type type); +int kgsl_cmdstream_freememontimestamp(unsigned int device_id, struct kgsl_memdesc *memdesc, unsigned int timestamp, enum kgsl_timestamp_type type); +int kgsl_cmdstream_waittimestamp(unsigned int device_id, unsigned int timestamp, unsigned int timeout); +int kgsl_cmdwindow_write(unsigned int device_id, enum kgsl_cmdwindow_type target, unsigned int addr, unsigned int data); +int kgsl_add_timestamp(unsigned int device_id, unsigned int *timestamp); +int kgsl_cmdstream_check_timestamp(unsigned int device_id, unsigned int timestamp); + #endif // __GSL_CMDSTREAM_H diff --git a/drivers/mxc/amd-gpu/kgsl_cmdwindow.c b/drivers/mxc/amd-gpu/kgsl_cmdwindow.c index d030c6b2a12..c70beb126d3 100644 --- a/drivers/mxc/amd-gpu/kgsl_cmdwindow.c +++ b/drivers/mxc/amd-gpu/kgsl_cmdwindow.c @@ -18,8 +18,17 @@ #include -#include "gsl.h" -#include "gsl_hal.h" +#include "kgsl_buildconfig.h" + +#include "kgsl_types.h" +#include "kgsl_hal.h" +#include "kgsl_mmu.h" +#include "kgsl_sharedmem.h" +#include "kgsl_device.h" +#include "kgsl_driver.h" +#include "kgsl_log.h" + +#include "g12_reg.h" // defines #define GSL_CMDWINDOW_TARGET_MASK 0x000000FF diff --git a/drivers/mxc/amd-gpu/include/gsl_cmdwindow.h b/drivers/mxc/amd-gpu/kgsl_cmdwindow.h similarity index 100% rename from drivers/mxc/amd-gpu/include/gsl_cmdwindow.h rename to drivers/mxc/amd-gpu/kgsl_cmdwindow.h diff --git a/drivers/mxc/amd-gpu/include/gsl_config.h b/drivers/mxc/amd-gpu/kgsl_config.h similarity index 96% rename from drivers/mxc/amd-gpu/include/gsl_config.h rename to drivers/mxc/amd-gpu/kgsl_config.h index 07a69150867..046ccda70b8 100644 --- a/drivers/mxc/amd-gpu/include/gsl_config.h +++ b/drivers/mxc/amd-gpu/kgsl_config.h @@ -33,6 +33,13 @@ #ifndef __GSL__CONFIG_H #define __GSL__CONFIG_H +#include "kgsl_types.h" // GSL_DEVICE_MAX +#include "kgsl_mmu.h" // kgsl_mmu_stuff + +#include "kgsl_ringbuffer.h" // GSL_RB_SIZE_* + +#include "g12_reg.h" // MH stuff +#include "yamato_reg.h" // bleh /* ------------------------ * Yamato ringbuffer config * ------------------------ */ diff --git a/drivers/mxc/amd-gpu/kgsl_context.c b/drivers/mxc/amd-gpu/kgsl_context.c index 000a19c200f..c2eacdb4c85 100644 --- a/drivers/mxc/amd-gpu/kgsl_context.c +++ b/drivers/mxc/amd-gpu/kgsl_context.c @@ -16,8 +16,22 @@ * */ -#include "gsl.h" -#include "gsl_hal.h" +#include "kgsl_types.h" +#include "kgsl_mmu.h" +#include "kgsl_buildconfig.h" +#include "kgsl_hal.h" +#include "kgsl_halconfig.h" +#include "kgsl_memmgr.h" +#include "kgsl_sharedmem.h" +#include "kgsl_properties.h" +#include "kgsl_intrmgr.h" +#include "kgsl_ringbuffer.h" +#include "kgsl_drawctxt.h" +#include "kgsl_cmdwindow.h" +#include "kgsl_device.h" +#include "kgsl_driver.h" +#include "kgsl_linux_map.h" +#include "kgsl_hwaccess.h" ////////////////////////////////////////////////////////////////////////////// // functions diff --git a/drivers/mxc/amd-gpu/include/gsl_display.h b/drivers/mxc/amd-gpu/kgsl_debug.h similarity index 64% rename from drivers/mxc/amd-gpu/include/gsl_display.h rename to drivers/mxc/amd-gpu/kgsl_debug.h index 82300647b3e..3d6f7c5ef3a 100644 --- a/drivers/mxc/amd-gpu/include/gsl_display.h +++ b/drivers/mxc/amd-gpu/kgsl_debug.h @@ -26,37 +26,32 @@ * */ -#ifndef __GSL_DISPLAY_H -#define __GSL_DISPLAY_H - -#define __GSLDISPLAY_EXPORTS - -#include "gsl_libapi.h" -#include "gsl_klibapi.h" // hack to enable direct reg write -#include "gsl_displayapi.h" - +#ifndef __GSL_DEBUG_H +#define __GSL_DEBUG_H ////////////////////////////////////////////////////////////////////////////// -// defines +// macros ////////////////////////////////////////////////////////////////////////////// -#define GSL_LIB_MAXDISPLAYS 1 -#define GSL_LIB_MAXSURFACES 3 +#ifdef _DEBUG +#define KGSL_DEBUG(flag, action) if (gsl_driver.flags_debug & flag) {action;} +#else +#define KGSL_DEBUG(flag, action) +#endif +#define KGSL_DEBUG_DUMPPM4(cmds, sizedwords) +#define KGSL_DEBUG_DUMPREGWRITE(addr, value) +#define KGSL_DEBUG_DUMPMEMWRITE(addr, sizebytes, data) +#define KGSL_DEBUG_DUMPMEMSET(addr, sizebytes, value) +#define KGSL_DEBUG_DUMPFBSTART(device) +#define KGSL_DEBUG_DUMPREGSPACE(device) +#define KGSL_DEBUG_DUMPWINDOW(addr, width, height) +#define KGSL_DEBUG_DUMPX(cmd, par1, par2, par3, comment) -////////////////////////////////////////////////////////////////////////////// -// types -////////////////////////////////////////////////////////////////////////////// -typedef struct _gsl_display_t { - int numdisplays; - gsl_displaymode_t mode[GSL_LIB_MAXDISPLAYS]; - gsl_devhandle_t devhandle; -} gsl_display_t; +#define KGSL_DEBUG_TBDUMP_OPEN(file) +#define KGSL_DEBUG_TBDUMP_CLOSE() +#define KGSL_DEBUG_TBDUMP_SYNCMEM(addr, src, sizebytes) +#define KGSL_DEBUG_TBDUMP_SETMEM(addr, value, sizebytes) +#define KGSL_DEBUG_TBDUMP_SLAVEWRITE(addr, value) +#define KGSL_DEBUG_TBDUMP_WAITIRQ() - -////////////////////////////////////////////////////////////////////////////// -// prototypes -////////////////////////////////////////////////////////////////////////////// -int gsl_display_hitachi_240x320_tft_init(int display_id); -int gsl_display_toshiba_640x480_tft_init(int display_id); - -#endif // __GSL_DISPLAY_H +#endif // __GSL_DEBUG_H diff --git a/drivers/mxc/amd-gpu/kgsl_device.c b/drivers/mxc/amd-gpu/kgsl_device.c index 43d2de218d0..47d56fb6958 100644 --- a/drivers/mxc/amd-gpu/kgsl_device.c +++ b/drivers/mxc/amd-gpu/kgsl_device.c @@ -18,8 +18,17 @@ #include -#include "gsl.h" -#include "gsl_hal.h" +#include "kgsl_types.h" +#include "kgsl_hal.h" +#include "kgsl_log.h" +#include "kgsl_device.h" +#include "kgsl_driver.h" +#include "kgsl_cmdstream.h" +#include "kgsl_ioctl.h" +#include "kgsl_debug.h" + +int kgsl_device_stop(unsigned int device_id); + ////////////////////////////////////////////////////////////////////////////// // inline functions @@ -557,7 +566,7 @@ kgsl_device_regread(unsigned int device_id, unsigned int offsetwords, unsigned i #ifdef CONFIG_KGSL_LOGGING - if( offsetwords != mmRBBM_STATUS && offsetwords != mmCP_RB_RPTR ) // Would otherwise flood the log + if( offsetwords != REG_RBBM_STATUS && offsetwords != REG_CP_RB_RPTR ) // Would otherwise flood the log kgsl_log_write( KGSL_LOG_GROUP_DEVICE | KGSL_LOG_LEVEL_TRACE, "--> int kgsl_device_regread(unsigned int device_id=%D, unsigned int offsetwords=%R, unsigned int *value=0x%08x)\n", device_id, offsetwords, value ); #endif @@ -577,7 +586,7 @@ kgsl_device_regread(unsigned int device_id, unsigned int offsetwords, unsigned i mutex_unlock(&gsl_driver.lock); #ifdef CONFIG_KGSL_LOGGING - if( offsetwords != mmRBBM_STATUS && offsetwords != mmCP_RB_RPTR ) + if( offsetwords != REG_RBBM_STATUS && offsetwords != REG_CP_RB_RPTR ) kgsl_log_write( KGSL_LOG_GROUP_DEVICE | KGSL_LOG_LEVEL_TRACE, "<-- kgsl_device_regread. Return value %B\n", status ); #endif diff --git a/drivers/mxc/amd-gpu/include/gsl_device.h b/drivers/mxc/amd-gpu/kgsl_device.h similarity index 81% rename from drivers/mxc/amd-gpu/include/gsl_device.h rename to drivers/mxc/amd-gpu/kgsl_device.h index a563c2c85b4..c1e685cf192 100644 --- a/drivers/mxc/amd-gpu/include/gsl_device.h +++ b/drivers/mxc/amd-gpu/kgsl_device.h @@ -36,6 +36,18 @@ // types ////////////////////////////////////////////////////////////////////////////// + +// forward declaration +struct kgsl_device; + +#include "kgsl_types.h" +#include "kgsl_intrmgr.h" // for gsl_intr_t +#include "kgsl_ringbuffer.h" // for gsl_ringbuffer_t +#include "kgsl_drawctxt.h" // gsl_drawctxt_t +#include "kgsl_cmdwindow.h" // for GSL_G12_INTR_COUNT +#include "kgsl_properties.h" // for gsl_property_type_t +#include "kgsl_mmu.h" // for kgsl_mmu + // -------------- // function table // -------------- @@ -62,6 +74,8 @@ struct kgsl_functable { int (*context_destroy) (struct kgsl_device *device_id, unsigned int drawctxt_id); }; +#define GSL_CALLER_PROCESS_MAX 64 + // device object struct kgsl_device { unsigned int refcnt; @@ -116,6 +130,16 @@ int kgsl_device_runpending(struct kgsl_device *device); int kgsl_yamato_getfunctable(struct kgsl_functable *ftbl); int kgsl_g12_getfunctable(struct kgsl_functable *ftbl); +int kgsl_device_start(unsigned int device_id, gsl_flags_t flags); +int kgsl_device_stop(unsigned int device_id); +int kgsl_device_idle(unsigned int device_id, unsigned int timeout); +int kgsl_device_isidle(unsigned int device_id); +int kgsl_device_getproperty(unsigned int device_id, gsl_property_type_t type, void *value, unsigned int sizebytes); +int kgsl_device_setproperty(unsigned int device_id, gsl_property_type_t type, void *value, unsigned int sizebytes); +int kgsl_device_regread(unsigned int device_id, unsigned int offsetwords, unsigned int *value); +int kgsl_device_regwrite(unsigned int device_id, unsigned int offsetwords, unsigned int value); +int kgsl_device_waitirq(unsigned int device_id, gsl_intrid_t intr_id, unsigned int *count, unsigned int timeout); + int kgsl_clock(unsigned int dev, int enable); int kgsl_device_active(struct kgsl_device *dev); int kgsl_device_clock(unsigned int id, int enable); diff --git a/drivers/mxc/amd-gpu/kgsl_drawctxt.c b/drivers/mxc/amd-gpu/kgsl_drawctxt.c index 3cc688f7321..bd1b2dbccfb 100644 --- a/drivers/mxc/amd-gpu/kgsl_drawctxt.c +++ b/drivers/mxc/amd-gpu/kgsl_drawctxt.c @@ -19,10 +19,26 @@ #include #include -#include "gsl.h" -#include "gsl_hal.h" +#include "kgsl_buildconfig.h" +#include "kgsl_types.h" +#include "kgsl_mmu.h" +#include "kgsl_properties.h" +#include "kgsl_device.h" +#include "kgsl_driver.h" +#include "kgsl_drawctxt.h" +#include "kgsl_hal.h" +#include "kgsl_properties.h" +#include "kgsl_ringbuffer.h" +#include "kgsl_memmgr.h" +#include "kgsl_sharedmem.h" +#include "kgsl_debug.h" + +#include "g12_reg.h" #include "kgsl_g12_vgv3types.h" +#include "yamato_reg.h" +#include "kgsl_pm4types.h" + ////////////////////////////////////////////////////////////////////////////// // // Memory Map for Register, Constant & Instruction Shadow, and Command Buffers (34.5KB) diff --git a/drivers/mxc/amd-gpu/include/gsl_drawctxt.h b/drivers/mxc/amd-gpu/kgsl_drawctxt.h similarity index 90% rename from drivers/mxc/amd-gpu/include/gsl_drawctxt.h rename to drivers/mxc/amd-gpu/kgsl_drawctxt.h index 8aae6166990..9d0e514e8f5 100644 --- a/drivers/mxc/amd-gpu/include/gsl_drawctxt.h +++ b/drivers/mxc/amd-gpu/kgsl_drawctxt.h @@ -29,6 +29,8 @@ #ifndef __GSL_DRAWCTXT_H #define __GSL_DRAWCTXT_H +#include "kgsl_types.h" + ////////////////////////////////////////////////////////////////////////////// // Flags ////////////////////////////////////////////////////////////////////////////// @@ -115,4 +117,10 @@ void kgsl_drawctxt_switch(struct kgsl_device *device, gsl_drawctxt_t *drawctx int kgsl_drawctxt_create(struct kgsl_device* device, gsl_context_type_t type, unsigned int *drawctxt_id, gsl_flags_t flags); int kgsl_drawctxt_destroy(struct kgsl_device* device, unsigned int drawctxt_id); +int kgsl_drawctxt_bind_gmem_shadow(unsigned int device_id, unsigned int drawctxt_id, const struct kgsl_gmem_desc* gmem_rect, unsigned int shadow_x, unsigned int shadow_y, const struct kgsl_buffer_desc* shadow_buffer, unsigned int buffer_id); + +/* these are in the wrong place..! */ +int kgsl_context_create(unsigned int device_id, gsl_context_type_t type, unsigned int *drawctxt_id, gsl_flags_t flags); +int kgsl_context_destroy(unsigned int device_id, unsigned int drawctxt_id); + #endif // __GSL_DRAWCTXT_H diff --git a/drivers/mxc/amd-gpu/kgsl_driver.c b/drivers/mxc/amd-gpu/kgsl_driver.c index 91d8f608292..78a47d3a44e 100644 --- a/drivers/mxc/amd-gpu/kgsl_driver.c +++ b/drivers/mxc/amd-gpu/kgsl_driver.c @@ -18,9 +18,11 @@ #include -#include "gsl.h" -#include "gsl_hal.h" - +#include "kgsl_driver.h" +#include "kgsl_debug.h" +#include "kgsl_device.h" +#include "kgsl_cmdstream.h" +#include "kgsl_log.h" ////////////////////////////////////////////////////////////////////////////// // defines @@ -131,8 +133,7 @@ kgsl_driver_close0(gsl_flags_t flags) //---------------------------------------------------------------------------- -int -kgsl_driver_init() +int kgsl_driver_init(void) { // only an external (platform specific device driver) component should call this @@ -141,8 +142,7 @@ kgsl_driver_init() //---------------------------------------------------------------------------- -int -kgsl_driver_close() +int kgsl_driver_close(void) { // only an external (platform specific device driver) component should call this diff --git a/drivers/mxc/amd-gpu/include/gsl_driver.h b/drivers/mxc/amd-gpu/kgsl_driver.h similarity index 88% rename from drivers/mxc/amd-gpu/include/gsl_driver.h rename to drivers/mxc/amd-gpu/kgsl_driver.h index 02f9d24dd5a..2c12c5bf28e 100644 --- a/drivers/mxc/amd-gpu/include/gsl_driver.h +++ b/drivers/mxc/amd-gpu/kgsl_driver.h @@ -31,6 +31,11 @@ #include +#include "kgsl_types.h" // GSL_DRIVER_MAX +#include "kgsl_device.h" // kgsl_device etc. +#include "kgsl_sharedmem.h" // gsl_sharedmem_t +#include "kgsl_buildconfig.h" // GSL_CALLER_PROCESS_MAX + ////////////////////////////////////////////////////////////////////////////// // types ////////////////////////////////////////////////////////////////////////////// @@ -80,5 +85,10 @@ kgsl_driver_getcallerprocessindex(unsigned int pid, int *index) return (GSL_FAILURE); } +int kgsl_driver_init(void); +int kgsl_driver_close(void); +int kgsl_driver_entry(gsl_flags_t flags); +int kgsl_driver_exit(void); +int kgsl_driver_destroy(unsigned int pid); #endif // __GSL_DRIVER_H diff --git a/drivers/mxc/amd-gpu/kgsl_g12.c b/drivers/mxc/amd-gpu/kgsl_g12.c index c09a9436aa3..1d170af394f 100644 --- a/drivers/mxc/amd-gpu/kgsl_g12.c +++ b/drivers/mxc/amd-gpu/kgsl_g12.c @@ -19,9 +19,15 @@ #include #include -#include "gsl.h" -#include "gsl_hal.h" -#include "gsl_cmdstream.h" +#include "kgsl_types.h" +#include "kgsl_hal.h" +#include "kgsl_cmdstream.h" +#include "kgsl_sharedmem.h" +#include "kgsl_driver.h" +#include "kgsl_hwaccess.h" +#include "kgsl_ioctl.h" + +#include "g12_reg.h" #include "kgsl_g12_vgv3types.h" #ifdef CONFIG_ARCH_MX35 diff --git a/drivers/mxc/amd-gpu/include/kgsl_g12_vgv3types.h b/drivers/mxc/amd-gpu/kgsl_g12_vgv3types.h similarity index 100% rename from drivers/mxc/amd-gpu/include/kgsl_g12_vgv3types.h rename to drivers/mxc/amd-gpu/kgsl_g12_vgv3types.h diff --git a/drivers/mxc/amd-gpu/kgsl_hal.c b/drivers/mxc/amd-gpu/kgsl_hal.c index 736b2c1155c..29ea347c0d1 100644 --- a/drivers/mxc/amd-gpu/kgsl_hal.c +++ b/drivers/mxc/amd-gpu/kgsl_hal.c @@ -21,10 +21,6 @@ * Copyright (C) 2010-2011 Freescale Semiconductor, Inc. All Rights Reserved. */ -#include "gsl_hal.h" -#include "gsl_halconfig.h" -#include "gsl_linux_map.h" - #include #include #include @@ -35,6 +31,14 @@ #include #include +#include "kgsl_hal.h" +#include "kgsl_halconfig.h" +#include "kgsl_linux_map.h" +#include "kgsl_driver.h" + +#include "yamato_reg.h" +#include "g12_reg.h" + #define DRVNAME "amd-gpu" #define GSL_HAL_MEM1 0 diff --git a/drivers/mxc/amd-gpu/include/gsl_hal.h b/drivers/mxc/amd-gpu/kgsl_hal.h similarity index 98% rename from drivers/mxc/amd-gpu/include/gsl_hal.h rename to drivers/mxc/amd-gpu/kgsl_hal.h index b81c185515d..1f7ae5044ab 100644 --- a/drivers/mxc/amd-gpu/include/gsl_hal.h +++ b/drivers/mxc/amd-gpu/kgsl_hal.h @@ -33,9 +33,7 @@ extern "C" { #endif // __cplusplus -#include "gsl.h" -#include "gsl_hwaccess.h" - +#include "kgsl_types.h" ////////////////////////////////////////////////////////////////////////////// // linkage @@ -86,6 +84,8 @@ typedef struct _gsl_apertureconfig_t unsigned int sizebytes; } gsl_apertureconfig_t; +#define GSL_SHMEM_MAX_APERTURES 2 + // -------------------- // shared memory config // -------------------- diff --git a/drivers/mxc/amd-gpu/include/gsl_halconfig.h b/drivers/mxc/amd-gpu/kgsl_halconfig.h similarity index 100% rename from drivers/mxc/amd-gpu/include/gsl_halconfig.h rename to drivers/mxc/amd-gpu/kgsl_halconfig.h diff --git a/drivers/mxc/amd-gpu/include/gsl_hwaccess.h b/drivers/mxc/amd-gpu/kgsl_hwaccess.h similarity index 97% rename from drivers/mxc/amd-gpu/include/gsl_hwaccess.h rename to drivers/mxc/amd-gpu/kgsl_hwaccess.h index 809f77c0a97..b140582b457 100644 --- a/drivers/mxc/amd-gpu/include/gsl_hwaccess.h +++ b/drivers/mxc/amd-gpu/kgsl_hwaccess.h @@ -33,7 +33,8 @@ #include #include -#include "gsl_linux_map.h" +#include "kgsl_halconfig.h" // EMEM_MMU stuff +#include "kgsl_linux_map.h" // GSL_LINUX_MAP_RANGE_START etc. static __inline void kgsl_hwaccess_memread(void *dst, unsigned int gpubase, unsigned int gpuoffset, unsigned int sizebytes, unsigned int touserspace) diff --git a/drivers/mxc/amd-gpu/kgsl_intrmgr.c b/drivers/mxc/amd-gpu/kgsl_intrmgr.c index 73a448fb561..422c7fb7ef3 100644 --- a/drivers/mxc/amd-gpu/kgsl_intrmgr.c +++ b/drivers/mxc/amd-gpu/kgsl_intrmgr.c @@ -19,7 +19,13 @@ #include #include -#include "gsl.h" +#include "kgsl_types.h" +#include "kgsl_intrmgr.h" +#include "kgsl_device.h" + +#include "yamato_reg.h" + +#include "kgsl_config.h" //gsl_cfg_intrblock_reg ////////////////////////////////////////////////////////////////////////////// // macros diff --git a/drivers/mxc/amd-gpu/include/gsl_intrmgr.h b/drivers/mxc/amd-gpu/kgsl_intrmgr.h similarity index 97% rename from drivers/mxc/amd-gpu/include/gsl_intrmgr.h rename to drivers/mxc/amd-gpu/kgsl_intrmgr.h index 2d4026b7b2a..652babd6d18 100644 --- a/drivers/mxc/amd-gpu/include/gsl_intrmgr.h +++ b/drivers/mxc/amd-gpu/kgsl_intrmgr.h @@ -31,6 +31,8 @@ #include +#include "kgsl_types.h" + ////////////////////////////////////////////////////////////////////////////// // types ////////////////////////////////////////////////////////////////////////////// @@ -102,4 +104,6 @@ int kgsl_intr_disable(gsl_intr_t *intr, gsl_intrid_t id); int kgsl_intr_isenabled(gsl_intr_t *intr, gsl_intrid_t id); void kgsl_intr_decode(struct kgsl_device *device, gsl_intrblock_t block_id); +void kgsl_intr_isr(struct kgsl_device *device); + #endif // __GSL_INTMGR_H diff --git a/drivers/mxc/amd-gpu/include/gsl_ioctl.h b/drivers/mxc/amd-gpu/kgsl_ioctl.h similarity index 99% rename from drivers/mxc/amd-gpu/include/gsl_ioctl.h rename to drivers/mxc/amd-gpu/kgsl_ioctl.h index c935e51e0af..664e8265549 100644 --- a/drivers/mxc/amd-gpu/include/gsl_ioctl.h +++ b/drivers/mxc/amd-gpu/kgsl_ioctl.h @@ -29,8 +29,8 @@ #ifndef _GSL_IOCTL_H #define _GSL_IOCTL_H -#include "gsl_types.h" -#include "gsl_properties.h" +#include "kgsl_types.h" +#include "kgsl_properties.h" ////////////////////////////////////////////////////////////////////////////// // types diff --git a/drivers/mxc/amd-gpu/kgsl_kmod.c b/drivers/mxc/amd-gpu/kgsl_kmod.c index 1170c552f0b..10b12ea149b 100644 --- a/drivers/mxc/amd-gpu/kgsl_kmod.c +++ b/drivers/mxc/amd-gpu/kgsl_kmod.c @@ -16,14 +16,6 @@ * */ -#include "gsl_types.h" -#include "gsl.h" -#include "gsl_buildconfig.h" -#include "gsl_halconfig.h" -#include "gsl_ioctl.h" -#include "kgsl_kmod_cleanup.h" -#include "gsl_linux_map.h" - #include #include #include @@ -41,6 +33,26 @@ #include + +#include "kgsl_types.h" +#include "kgsl_properties.h" +#include "kgsl_linux_map.h" +#include "kgsl_ioctl.h" +#include "kgsl_driver.h" + +#include "kgsl_device.h" + +#include "kgsl_sharedmem.h" +#include "kgsl_cmdstream.h" +#include "kgsl_cmdwindow.h" + +//#include "gsl_buildconfig.h" +#include "kgsl_halconfig.h" +//#include "gsl_ioctl.h" + +#include "kgsl_kmod_cleanup.h" + + //#define GSL_IOCTL_DEBUG int gpu_2d_irq, gpu_3d_irq; diff --git a/drivers/mxc/amd-gpu/kgsl_kmod_cleanup.c b/drivers/mxc/amd-gpu/kgsl_kmod_cleanup.c index 000c80952a1..ed8395c1e41 100644 --- a/drivers/mxc/amd-gpu/kgsl_kmod_cleanup.c +++ b/drivers/mxc/amd-gpu/kgsl_kmod_cleanup.c @@ -15,13 +15,15 @@ * 02110-1301, USA. * */ - -#include "gsl.h" -#include "kgsl_kmod_cleanup.h" #include #include +#include "kgsl_kmod_cleanup.h" +#include "kgsl_device.h" +#include "kgsl_drawctxt.h" +#include "kgsl_sharedmem.h" + /* * Local helper functions to check and convert device/context id's (1 based) * to index (0 based). diff --git a/drivers/mxc/amd-gpu/kgsl_kmod_cleanup.h b/drivers/mxc/amd-gpu/kgsl_kmod_cleanup.h index 941d5f699ed..dd14e3415f2 100644 --- a/drivers/mxc/amd-gpu/kgsl_kmod_cleanup.h +++ b/drivers/mxc/amd-gpu/kgsl_kmod_cleanup.h @@ -28,13 +28,14 @@ #ifndef __GSL_KMOD_CLEANUP_H #define __GSL_KMOD_CLEANUP_H -#include "gsl_types.h" #include #include #include #include +#include "kgsl_types.h" + #if (GSL_CONTEXT_MAX > 127) #error created_contexts_array supports context numbers only 127 or less. #endif diff --git a/drivers/mxc/amd-gpu/kgsl_linux_map.c b/drivers/mxc/amd-gpu/kgsl_linux_map.c index 9a2c4b30ce8..006ce7cc17b 100644 --- a/drivers/mxc/amd-gpu/kgsl_linux_map.c +++ b/drivers/mxc/amd-gpu/kgsl_linux_map.c @@ -23,7 +23,7 @@ #include #include -#include "gsl_linux_map.h" +#include "kgsl_linux_map.h" struct gsl_linux_map { diff --git a/drivers/mxc/amd-gpu/include/gsl_linux_map.h b/drivers/mxc/amd-gpu/kgsl_linux_map.h similarity index 98% rename from drivers/mxc/amd-gpu/include/gsl_linux_map.h rename to drivers/mxc/amd-gpu/kgsl_linux_map.h index bdab64e9737..c4ab297145b 100644 --- a/drivers/mxc/amd-gpu/include/gsl_linux_map.h +++ b/drivers/mxc/amd-gpu/kgsl_linux_map.h @@ -29,8 +29,6 @@ #ifndef __GSL_LINUX_MAP_H__ #define __GSL_LINUX_MAP_H__ -#include "gsl_halconfig.h" - #define GSL_LINUX_MAP_RANGE_START (1024*1024) #define GSL_LINUX_MAP_RANGE_END (GSL_LINUX_MAP_RANGE_START+GSL_HAL_SHMEM_SIZE_EMEM_MMU) diff --git a/drivers/mxc/amd-gpu/include/gsl_log.h b/drivers/mxc/amd-gpu/kgsl_log.h similarity index 100% rename from drivers/mxc/amd-gpu/include/gsl_log.h rename to drivers/mxc/amd-gpu/kgsl_log.h diff --git a/drivers/mxc/amd-gpu/kgsl_memmgr.c b/drivers/mxc/amd-gpu/kgsl_memmgr.c index 0ed3d4eaa06..5c46fcbe707 100644 --- a/drivers/mxc/amd-gpu/kgsl_memmgr.c +++ b/drivers/mxc/amd-gpu/kgsl_memmgr.c @@ -18,8 +18,10 @@ #include -#include "gsl.h" -#include "gsl_hal.h" +#include "kgsl_types.h" +#include "kgsl_memmgr.h" +#include "kgsl_debug.h" +#include "kgsl_log.h" /* * defines diff --git a/drivers/mxc/amd-gpu/include/gsl_memmgr.h b/drivers/mxc/amd-gpu/kgsl_memmgr.h similarity index 100% rename from drivers/mxc/amd-gpu/include/gsl_memmgr.h rename to drivers/mxc/amd-gpu/kgsl_memmgr.h diff --git a/drivers/mxc/amd-gpu/kgsl_mmu.c b/drivers/mxc/amd-gpu/kgsl_mmu.c index cbb9aa611bc..d23a5e2e9fc 100644 --- a/drivers/mxc/amd-gpu/kgsl_mmu.c +++ b/drivers/mxc/amd-gpu/kgsl_mmu.c @@ -19,9 +19,13 @@ #include #include -#include "gsl.h" -#include "gsl_hal.h" - +#include "kgsl_sharedmem.h" +#include "kgsl_mmu.h" +#include "kgsl_device.h" +#include "kgsl_log.h" +#include "kgsl_config.h" +#include "kgsl_driver.h" +#include "kgsl_debug.h" ////////////////////////////////////////////////////////////////////////////// // types diff --git a/drivers/mxc/amd-gpu/include/gsl_mmu.h b/drivers/mxc/amd-gpu/kgsl_mmu.h similarity index 98% rename from drivers/mxc/amd-gpu/include/gsl_mmu.h rename to drivers/mxc/amd-gpu/kgsl_mmu.h index ae06c926513..986cb8d0559 100644 --- a/drivers/mxc/amd-gpu/include/gsl_mmu.h +++ b/drivers/mxc/amd-gpu/kgsl_mmu.h @@ -29,6 +29,8 @@ #ifndef __GSL_MMU_H #define __GSL_MMU_H +#include "kgsl_types.h" +#include "kgsl_buildconfig.h" // ugh stats ////////////////////////////////////////////////////////////////////////////// // defines diff --git a/drivers/mxc/amd-gpu/include/api/gsl_pm4types.h b/drivers/mxc/amd-gpu/kgsl_pm4types.h similarity index 100% rename from drivers/mxc/amd-gpu/include/api/gsl_pm4types.h rename to drivers/mxc/amd-gpu/kgsl_pm4types.h diff --git a/drivers/mxc/amd-gpu/include/api/gsl_properties.h b/drivers/mxc/amd-gpu/kgsl_properties.h similarity index 99% rename from drivers/mxc/amd-gpu/include/api/gsl_properties.h rename to drivers/mxc/amd-gpu/kgsl_properties.h index 520761fe349..70f5cf21e55 100644 --- a/drivers/mxc/amd-gpu/include/api/gsl_properties.h +++ b/drivers/mxc/amd-gpu/kgsl_properties.h @@ -29,6 +29,7 @@ #ifndef __GSL_PROPERTIES_H #define __GSL_PROPERTIES_H +#include "kgsl_types.h" ////////////////////////////////////////////////////////////////////////////// // types diff --git a/drivers/mxc/amd-gpu/kgsl_pwrctrl.c b/drivers/mxc/amd-gpu/kgsl_pwrctrl.c index 6d973102f80..5a77cbec64f 100644 --- a/drivers/mxc/amd-gpu/kgsl_pwrctrl.c +++ b/drivers/mxc/amd-gpu/kgsl_pwrctrl.c @@ -18,16 +18,17 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include - #include #include #include #include #include +#include "kgsl_device.h" +#include "kgsl_driver.h" + typedef struct _gsl_autogate_t { - struct timer_list timer; + struct timer_list timer; spinlock_t lock; int active; /* pending indicate the timer has been fired but clock not yet disabled. */ diff --git a/drivers/mxc/amd-gpu/kgsl_ringbuffer.c b/drivers/mxc/amd-gpu/kgsl_ringbuffer.c index f204f29d946..9e10bba46e7 100644 --- a/drivers/mxc/amd-gpu/kgsl_ringbuffer.c +++ b/drivers/mxc/amd-gpu/kgsl_ringbuffer.c @@ -18,10 +18,18 @@ #include -#include "gsl.h" -#include "gsl_hal.h" -#include "gsl_cmdstream.h" -#include "gsl_ringbuffer.h" +#include "kgsl_types.h" +#include "kgsl_hal.h" +#include "kgsl_cmdstream.h" +#include "kgsl_ringbuffer.h" +#include "kgsl_driver.h" +#include "kgsl_log.h" +#include "kgsl_debug.h" + +#include "kgsl_config.h" + +#include "yamato_reg.h" +#include "kgsl_pm4types.h" ////////////////////////////////////////////////////////////////////////////// // ucode diff --git a/drivers/mxc/amd-gpu/include/gsl_ringbuffer.h b/drivers/mxc/amd-gpu/kgsl_ringbuffer.h similarity index 96% rename from drivers/mxc/amd-gpu/include/gsl_ringbuffer.h rename to drivers/mxc/amd-gpu/kgsl_ringbuffer.h index ba8774428df..116537686ea 100644 --- a/drivers/mxc/amd-gpu/include/gsl_ringbuffer.h +++ b/drivers/mxc/amd-gpu/kgsl_ringbuffer.h @@ -29,6 +29,14 @@ #ifndef __GSL_RINGBUFFER_H #define __GSL_RINGBUFFER_H +// CONFIGURATION ITEMS +#define GSL_RB_USE_MEM_RPTR +#define GSL_RB_USE_MEM_TIMESTAMP +#define GSL_RB_TIMESTAMP_INTERUPT +/* #define GSL_RB_USE_WPTR_POLLING */ + +#include "kgsl_types.h" + ////////////////////////////////////////////////////////////////////////////// // defines @@ -64,7 +72,7 @@ #define GSL_HAL_SUBBLOCK_OFFSET(reg) ((unsigned int)((reg) - (0x2000))) // CP timestamp register -#define mmCP_TIMESTAMP mmSCRATCH_REG0 +#define REG_CP_TIMESTAMP REG_SCRATCH_REG0 ////////////////////////////////////////////////////////////////////////////// @@ -179,7 +187,7 @@ typedef struct _gsl_ringbuffer_t { #else #define GSL_RB_MEMPTRS_SCRATCH_MASK 0x0 // disable -#define GSL_RB_INIT_TIMESTAMP(rb) kgsl_device_regwrite((rb)->device->id, mmCP_TIMESTAMP, 0); +#define GSL_RB_INIT_TIMESTAMP(rb) kgsl_device_regwrite((rb)->device->id, REG_CP_TIMESTAMP, 0); #endif // GSL_RB_USE_MEMTIMESTAMP // -------- @@ -190,7 +198,7 @@ typedef struct _gsl_ringbuffer_t { #define GSL_RB_GET_READPTR(rb, data) kgsl_sharedmem_read0(&(rb)->memptrs_desc, (data), GSL_RB_MEMPTRS_RPTR_OFFSET, 4, false) #else #define GSL_RB_CNTL_NO_UPDATE 0x1 // disable -#define GSL_RB_GET_READPTR(rb, data) (rb)->device->fbtl.device_regread((rb)->device, mmCP_RB_RPTR,(data)) +#define GSL_RB_GET_READPTR(rb, data) (rb)->device->fbtl.device_regread((rb)->device, REG_CP_RB_RPTR,(data)) #endif // GSL_RB_USE_MEMRPTR // ------------ diff --git a/drivers/mxc/amd-gpu/kgsl_sharedmem.c b/drivers/mxc/amd-gpu/kgsl_sharedmem.c index 9dea6b410b7..c2ad67b85f8 100644 --- a/drivers/mxc/amd-gpu/kgsl_sharedmem.c +++ b/drivers/mxc/amd-gpu/kgsl_sharedmem.c @@ -19,8 +19,12 @@ #include #include -#include "gsl.h" -#include "gsl_hal.h" +#include "kgsl_types.h" +#include "kgsl_driver.h" +#include "kgsl_sharedmem.h" +#include "kgsl_hwaccess.h" +#include "kgsl_debug.h" +#include "kgsl_log.h" ///////////////////////////////////////////////////////////////////////////// // macros diff --git a/drivers/mxc/amd-gpu/include/gsl_sharedmem.h b/drivers/mxc/amd-gpu/kgsl_sharedmem.h similarity index 76% rename from drivers/mxc/amd-gpu/include/gsl_sharedmem.h rename to drivers/mxc/amd-gpu/kgsl_sharedmem.h index 973858ddd4f..efd4c347cc5 100644 --- a/drivers/mxc/amd-gpu/include/gsl_sharedmem.h +++ b/drivers/mxc/amd-gpu/kgsl_sharedmem.h @@ -29,6 +29,8 @@ #ifndef __GSL_SHAREDMEM_H #define __GSL_SHAREDMEM_H +#include "kgsl_hal.h" // MAX_APERTURES +#include "kgsl_memmgr.h" ////////////////////////////////////////////////////////////////////////////// // defines @@ -107,4 +109,17 @@ int kgsl_sharedmem_set0(const struct kgsl_memdesc *memdesc, unsigned int kgsl_sharedmem_querystats(gsl_sharedmem_t *shmem, gsl_sharedmem_stats_t *stats); unsigned int kgsl_sharedmem_convertaddr(unsigned int addr, int type); + +int kgsl_sharedmem_alloc(unsigned int device_id, gsl_flags_t flags, int sizebytes, struct kgsl_memdesc *memdesc); +int kgsl_sharedmem_free(struct kgsl_memdesc *memdesc); +int kgsl_sharedmem_read(const struct kgsl_memdesc *memdesc, void *dst, unsigned int offsetbytes, unsigned int sizebytes, unsigned int touserspace); +int kgsl_sharedmem_write(const struct kgsl_memdesc *memdesc, unsigned int offsetbytes, void *src, unsigned int sizebytes, unsigned int fromuserspace); +int kgsl_sharedmem_set(const struct kgsl_memdesc *memdesc, unsigned int offsetbytes, unsigned int value, unsigned int sizebytes); +unsigned int kgsl_sharedmem_largestfreeblock(unsigned int device_id, gsl_flags_t flags); +int kgsl_sharedmem_map(unsigned int device_id, gsl_flags_t flags, const gsl_scatterlist_t *scatterlist, struct kgsl_memdesc *memdesc); +int kgsl_sharedmem_unmap(struct kgsl_memdesc *memdesc); +int kgsl_sharedmem_getmap(const struct kgsl_memdesc *memdesc, gsl_scatterlist_t *scatterlist); +int kgsl_sharedmem_cacheoperation(const struct kgsl_memdesc *memdesc, unsigned int offsetbytes, unsigned int sizebytes, unsigned int operation); +int kgsl_sharedmem_fromhostpointer(unsigned int device_id, struct kgsl_memdesc *memdesc, void* hostptr); + #endif // __GSL_SHAREDMEM_H diff --git a/drivers/mxc/amd-gpu/include/api/gsl_types.h b/drivers/mxc/amd-gpu/kgsl_types.h similarity index 99% rename from drivers/mxc/amd-gpu/include/api/gsl_types.h rename to drivers/mxc/amd-gpu/kgsl_types.h index ae9a59afb8f..c94519754df 100644 --- a/drivers/mxc/amd-gpu/include/api/gsl_types.h +++ b/drivers/mxc/amd-gpu/kgsl_types.h @@ -508,4 +508,6 @@ typedef enum _gsl_intrid_t GSL_INTR_FOOBAR = 0x7FFFFFFF } gsl_intrid_t; +#define DEBUG_ASSERT(x) + #endif // __GSL_TYPES_H diff --git a/drivers/mxc/amd-gpu/kgsl_yamato.c b/drivers/mxc/amd-gpu/kgsl_yamato.c index e6273e2f9e2..f68d59d1829 100644 --- a/drivers/mxc/amd-gpu/kgsl_yamato.c +++ b/drivers/mxc/amd-gpu/kgsl_yamato.c @@ -19,12 +19,18 @@ #include #include -#include "gsl.h" -#include "gsl_hal.h" +#include "kgsl_types.h" +#include "kgsl_device.h" +#include "kgsl_driver.h" +#include "kgsl_ringbuffer.h" // needed for rb config +#include "kgsl_drawctxt.h" +#include "kgsl_cmdstream.h" +#include "kgsl_hwaccess.h" -#include "gsl_ringbuffer.h" -#include "gsl_drawctxt.h" +#include "yamato_reg.h" +#include "kgsl_pm4types.h" +#include "kgsl_debug.h" /* Yamato MH arbiter config*/ #define KGSL_CFG_YAMATO_MHARB \ diff --git a/drivers/mxc/amd-gpu/include/yamato_reg.h b/drivers/mxc/amd-gpu/yamato_reg.h similarity index 99% rename from drivers/mxc/amd-gpu/include/yamato_reg.h rename to drivers/mxc/amd-gpu/yamato_reg.h index 798eac82dfe..0fa53c824bf 100644 --- a/drivers/mxc/amd-gpu/include/yamato_reg.h +++ b/drivers/mxc/amd-gpu/yamato_reg.h @@ -389,7 +389,6 @@ union reg_cp_rb_cntl { #define REG_SCRATCH_ADDR 0x01DD #define REG_SCRATCH_REG0 0x0578 -#define REG_CP_TIMESTAMP REG_SCRATCH_REG0 // hack for fsl/qcom compat #define REG_SCRATCH_REG2 0x057A #define REG_SCRATCH_REG7 0x057F // fsl #define REG_SCRATCH_UMSK 0x01DC