mirror of
https://github.com/genesi/linux-legacy.git
synced 2026-09-24 07:34:24 +00:00
amd-gpu: more qualcommizing
gsl_ringbuffer_t et al -> struct kgsl_ringbuffer et al some macros GSL_ -> KGSL_ some macros safer (do/while(0)) some access functions done differently (writel instead of mem access) some access functions grew barriers
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include "kgsl_linux_map.h"
|
||||
#include "kgsl_halconfig.h"
|
||||
#include "kgsl_hal.h"
|
||||
#include "kgsl_ringbuffer.h" // for defines for the include below!
|
||||
#include "kgsl_cmdstream.h"
|
||||
#include "kgsl_g12_vgv3types.h"
|
||||
#include "kgsl_log.h"
|
||||
@@ -67,12 +68,12 @@ unsigned int kgsl_cmdstream_readtimestamp0(unsigned int device_id, enum kgsl_tim
|
||||
if (type == GSL_TIMESTAMP_CONSUMED)
|
||||
{
|
||||
// start-of-pipeline timestamp
|
||||
GSL_CMDSTREAM_GET_SOP_TIMESTAMP(device, ×tamp);
|
||||
KGSL_CMDSTREAM_GET_SOP_TIMESTAMP(device, ×tamp);
|
||||
}
|
||||
else if (type == GSL_TIMESTAMP_RETIRED)
|
||||
{
|
||||
// end-of-pipeline timestamp
|
||||
GSL_CMDSTREAM_GET_EOP_TIMESTAMP(device, ×tamp);
|
||||
KGSL_CMDSTREAM_GET_EOP_TIMESTAMP(device, ×tamp);
|
||||
}
|
||||
kgsl_log_write( KGSL_LOG_GROUP_COMMAND | KGSL_LOG_LEVEL_TRACE, "<-- kgsl_ringbuffer_readtimestamp. Return value %d\n", timestamp );
|
||||
return (timestamp);
|
||||
|
||||
@@ -31,8 +31,37 @@
|
||||
|
||||
#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)
|
||||
#ifdef KGSL_DEVICE_SHADOW_MEMSTORE_TO_USER
|
||||
#define KGSL_CMDSTREAM_USE_MEM_TIMESTAMP
|
||||
#endif /* KGSL_DEVICE_SHADOW_MEMSTORE_TO_USER */
|
||||
|
||||
/* old
|
||||
-#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)
|
||||
*/
|
||||
|
||||
/* new
|
||||
#ifdef KGSL_CMDSTREAM_USE_MEM_TIMESTAMP
|
||||
#define KGSL_CMDSTREAM_GET_SOP_TIMESTAMP(device, data) \
|
||||
kgsl_sharedmem_read0(&device->memstore, (data), \
|
||||
KGSL_DEVICE_MEMSTORE_OFFSET(soptimestamp), 4, false)
|
||||
// the false above is not in qualcomm's driver
|
||||
#else
|
||||
#define KGSL_CMDSTREAM_GET_SOP_TIMESTAMP(device, data) \
|
||||
do { \
|
||||
device->fbtl.device_regread(device, REG_CP_TIMESTAMP,(data)); \
|
||||
} while (0)
|
||||
// qcom: use yamato directly!
|
||||
#endif // KGSL_CMDSTREAM_USE_MEM_TIMESTAMP
|
||||
*/
|
||||
|
||||
#define KGSL_CMDSTREAM_GET_SOP_TIMESTAMP(device, data) \
|
||||
kgsl_sharedmem_read0(&device->memstore, (data), \
|
||||
KGSL_DEVICE_MEMSTORE_OFFSET(soptimestamp), 4, false)
|
||||
|
||||
#define KGSL_CMDSTREAM_GET_EOP_TIMESTAMP(device, data) \
|
||||
kgsl_sharedmem_read0(&device->memstore, (data), \
|
||||
KGSL_DEVICE_MEMSTORE_OFFSET(eoptimestamp), 4, false)
|
||||
|
||||
unsigned int kgsl_cmdstream_readtimestamp0(unsigned int device_id, enum kgsl_timestamp_type type);
|
||||
void kgsl_cmdstream_memqueue_drain(struct kgsl_device *device);
|
||||
|
||||
@@ -42,7 +42,7 @@ 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_ringbuffer.h" // for struct kgsl_ringbuffer
|
||||
#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
|
||||
@@ -98,7 +98,7 @@ struct kgsl_device {
|
||||
#endif
|
||||
|
||||
struct kgsl_memregion gmemspace;
|
||||
gsl_ringbuffer_t ringbuffer;
|
||||
struct kgsl_ringbuffer ringbuffer;
|
||||
struct mutex *drawctxt_mutex;
|
||||
unsigned int drawctxt_count;
|
||||
gsl_drawctxt_t *drawctxt_active;
|
||||
|
||||
@@ -256,7 +256,7 @@ static void kgsl_g12_updatetimestamp(struct kgsl_device *device)
|
||||
kgsl_cmdwindow_write0(2, GSL_CMDWINDOW_2D, ADDR_VGV3_CONTROL, 0);
|
||||
}
|
||||
#endif
|
||||
kgsl_sharedmem_write0(&device->memstore, GSL_DEVICE_MEMSTORE_OFFSET(eoptimestamp), &device->timestamp, 4, 0);
|
||||
kgsl_sharedmem_write0(&device->memstore, KGSL_DEVICE_MEMSTORE_OFFSET(eoptimestamp), &device->timestamp, 4, 0);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -749,13 +749,13 @@ kgsl_g12_issueibcmds(struct kgsl_device* device, int drawctxt_index, uint32_t ib
|
||||
(void) flags;
|
||||
|
||||
// read what is the latest timestamp device have processed
|
||||
GSL_CMDSTREAM_GET_EOP_TIMESTAMP(device, (int *)&processed_timestamp);
|
||||
KGSL_CMDSTREAM_GET_EOP_TIMESTAMP(device, (int *)&processed_timestamp);
|
||||
|
||||
/* wait for the next buffer's timestamp to occur */
|
||||
while(processed_timestamp < g_z1xx.timestamp[nextbuf])
|
||||
{
|
||||
kgsl_cmdstream_waittimestamp(device->id, g_z1xx.timestamp[nextbuf], 1000);
|
||||
GSL_CMDSTREAM_GET_EOP_TIMESTAMP(device, (int *)&processed_timestamp);
|
||||
KGSL_CMDSTREAM_GET_EOP_TIMESTAMP(device, (int *)&processed_timestamp);
|
||||
}
|
||||
|
||||
*timestamp = g_z1xx.timestamp[nextbuf] = device->current_timestamp + 1;
|
||||
@@ -795,7 +795,7 @@ kgsl_g12_issueibcmds(struct kgsl_device* device, int drawctxt_index, uint32_t ib
|
||||
|
||||
/* increment consumed timestamp */
|
||||
device->current_timestamp++;
|
||||
kgsl_sharedmem_write0(&device->memstore, GSL_DEVICE_MEMSTORE_OFFSET(soptimestamp), &device->current_timestamp, 4, 0);
|
||||
kgsl_sharedmem_write0(&device->memstore, KGSL_DEVICE_MEMSTORE_OFFSET(soptimestamp), &device->current_timestamp, 4, 0);
|
||||
return (GSL_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/io.h> // writel
|
||||
#include <linux/sched.h>
|
||||
|
||||
#include "kgsl_types.h"
|
||||
@@ -71,7 +72,7 @@ gsl_ringbuffer_sizelog2quadwords(unsigned int sizedwords)
|
||||
// private prototypes
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef _DEBUG
|
||||
static void kgsl_ringbuffer_debug(gsl_ringbuffer_t *rb, gsl_rb_debug_t *rb_debug);
|
||||
static void kgsl_ringbuffer_debug(struct kgsl_ringbuffer *rb, gsl_rb_debug_t *rb_debug);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -82,7 +83,7 @@ static void kgsl_ringbuffer_debug(gsl_ringbuffer_t *rb, gsl_rb_debug_t *rb_d
|
||||
void
|
||||
kgsl_cp_intrcallback(gsl_intrid_t id, void *cookie)
|
||||
{
|
||||
gsl_ringbuffer_t *rb = (gsl_ringbuffer_t *) cookie;
|
||||
struct kgsl_ringbuffer *rb = (struct kgsl_ringbuffer *) cookie;
|
||||
|
||||
kgsl_log_write( KGSL_LOG_GROUP_COMMAND | KGSL_LOG_LEVEL_TRACE,
|
||||
"--> void kgsl_cp_intrcallback(gsl_intrid_t id=%I, void *cookie=0x%08x)\n", id, cookie );
|
||||
@@ -122,7 +123,7 @@ kgsl_cp_intrcallback(gsl_intrid_t id, void *cookie)
|
||||
void
|
||||
kgsl_ringbuffer_watchdog()
|
||||
{
|
||||
gsl_ringbuffer_t *rb = &(gsl_driver.device[KGSL_DEVICE_YAMATO-1]).ringbuffer; // device_id is 1 based
|
||||
struct kgsl_ringbuffer *rb = &(gsl_driver.device[KGSL_DEVICE_YAMATO-1]).ringbuffer; // device_id is 1 based
|
||||
|
||||
kgsl_log_write( KGSL_LOG_GROUP_COMMAND | KGSL_LOG_LEVEL_TRACE,
|
||||
"--> void kgsl_ringbuffer_watchdog()\n" );
|
||||
@@ -351,10 +352,10 @@ kgsl_ringbuffer_checkpm4(unsigned int* cmds, unsigned int sizedwords, int pmodeo
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
static void
|
||||
kgsl_ringbuffer_submit(gsl_ringbuffer_t *rb)
|
||||
kgsl_ringbuffer_submit(struct kgsl_ringbuffer *rb)
|
||||
{
|
||||
kgsl_log_write( KGSL_LOG_GROUP_COMMAND | KGSL_LOG_LEVEL_TRACE,
|
||||
"--> static void kgsl_ringbuffer_submit(gsl_ringbuffer_t *rb=0x%08x)\n", rb );
|
||||
"--> static void kgsl_ringbuffer_submit(struct kgsl_ringbuffer *rb=0x%08x)\n", rb );
|
||||
|
||||
DEBUG_ASSERT(rb->wptr != 0);
|
||||
|
||||
@@ -373,14 +374,14 @@ kgsl_ringbuffer_submit(gsl_ringbuffer_t *rb)
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
static int
|
||||
kgsl_ringbuffer_waitspace(gsl_ringbuffer_t *rb, unsigned int numcmds, int wptr_ahead)
|
||||
kgsl_ringbuffer_waitspace(struct kgsl_ringbuffer *rb, unsigned int numcmds, int wptr_ahead)
|
||||
{
|
||||
int nopcount;
|
||||
unsigned int freecmds;
|
||||
unsigned int *cmds;
|
||||
|
||||
kgsl_log_write( KGSL_LOG_GROUP_COMMAND | KGSL_LOG_LEVEL_TRACE,
|
||||
"--> static int kgsl_ringbuffer_waitspace(gsl_ringbuffer_t *rb=0x%08x, unsigned int numcmds=%d, int wptr_ahead=%d)\n",
|
||||
"--> static int kgsl_ringbuffer_waitspace(struct kgsl_ringbuffer *rb=0x%08x, unsigned int numcmds=%d, int wptr_ahead=%d)\n",
|
||||
rb, numcmds, wptr_ahead );
|
||||
|
||||
|
||||
@@ -424,13 +425,13 @@ kgsl_ringbuffer_waitspace(gsl_ringbuffer_t *rb, unsigned int numcmds, int wptr_a
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
static unsigned int *
|
||||
kgsl_ringbuffer_addcmds(gsl_ringbuffer_t *rb, unsigned int numcmds)
|
||||
kgsl_ringbuffer_addcmds(struct kgsl_ringbuffer *rb, unsigned int numcmds)
|
||||
{
|
||||
unsigned int *ptr;
|
||||
int status = GSL_SUCCESS;
|
||||
|
||||
kgsl_log_write( KGSL_LOG_GROUP_COMMAND | KGSL_LOG_LEVEL_TRACE,
|
||||
"--> static unsigned int* kgsl_ringbuffer_addcmds(gsl_ringbuffer_t *rb=0x%08x, unsigned int numcmds=%d)\n",
|
||||
"--> static unsigned int* kgsl_ringbuffer_addcmds(struct kgsl_ringbuffer *rb=0x%08x, unsigned int numcmds=%d)\n",
|
||||
rb, numcmds );
|
||||
|
||||
DEBUG_ASSERT(numcmds < rb->sizedwords);
|
||||
@@ -482,7 +483,7 @@ kgsl_ringbuffer_addcmds(gsl_ringbuffer_t *rb, unsigned int numcmds)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
kgsl_ringbuffer_start(gsl_ringbuffer_t *rb)
|
||||
kgsl_ringbuffer_start(struct kgsl_ringbuffer *rb)
|
||||
{
|
||||
int status;
|
||||
/*cp_rb_cntl_u cp_rb_cntl;*/
|
||||
@@ -492,7 +493,7 @@ kgsl_ringbuffer_start(gsl_ringbuffer_t *rb)
|
||||
struct kgsl_device *device = rb->device;
|
||||
|
||||
kgsl_log_write( KGSL_LOG_GROUP_COMMAND | KGSL_LOG_LEVEL_TRACE,
|
||||
"--> static int kgsl_ringbuffer_start(gsl_ringbuffer_t *rb=0x%08x)\n", rb );
|
||||
"--> static int kgsl_ringbuffer_start(struct kgsl_ringbuffer *rb=0x%08x)\n", rb );
|
||||
|
||||
if (rb->flags & GSL_FLAGS_STARTED)
|
||||
{
|
||||
@@ -501,7 +502,7 @@ kgsl_ringbuffer_start(gsl_ringbuffer_t *rb)
|
||||
}
|
||||
|
||||
// clear memptrs values
|
||||
kgsl_sharedmem_set0(&rb->memptrs_desc, 0, 0, sizeof(gsl_rbmemptrs_t));
|
||||
kgsl_sharedmem_set0(&rb->memptrs_desc, 0, 0, sizeof(struct kgsl_rbmemptrs));
|
||||
|
||||
// clear ringbuffer
|
||||
kgsl_sharedmem_set0(&rb->buffer_desc, 0, 0x12341234, (rb->sizedwords << 2));
|
||||
@@ -535,7 +536,7 @@ kgsl_ringbuffer_start(gsl_ringbuffer_t *rb)
|
||||
}
|
||||
|
||||
// setup scratch/timestamp addr
|
||||
device->ftbl.regwrite(device, REG_SCRATCH_ADDR, device->memstore.gpuaddr + GSL_DEVICE_MEMSTORE_OFFSET(soptimestamp));
|
||||
device->ftbl.regwrite(device, REG_SCRATCH_ADDR, device->memstore.gpuaddr + KGSL_DEVICE_MEMSTORE_OFFSET(soptimestamp));
|
||||
|
||||
// setup scratch/timestamp mask
|
||||
device->ftbl.regwrite(device, REG_SCRATCH_UMSK, GSL_RB_MEMPTRS_SCRATCH_MASK);
|
||||
@@ -637,10 +638,10 @@ kgsl_ringbuffer_start(gsl_ringbuffer_t *rb)
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
int
|
||||
kgsl_ringbuffer_stop(gsl_ringbuffer_t *rb)
|
||||
kgsl_ringbuffer_stop(struct kgsl_ringbuffer *rb)
|
||||
{
|
||||
kgsl_log_write( KGSL_LOG_GROUP_COMMAND | KGSL_LOG_LEVEL_TRACE,
|
||||
"--> static int kgsl_ringbuffer_stop(gsl_ringbuffer_t *rb=0x%08x)\n", rb );
|
||||
"--> static int kgsl_ringbuffer_stop(struct kgsl_ringbuffer *rb=0x%08x)\n", rb );
|
||||
|
||||
if (rb->flags & GSL_FLAGS_STARTED)
|
||||
{
|
||||
@@ -673,7 +674,7 @@ kgsl_ringbuffer_init(struct kgsl_device *device)
|
||||
{
|
||||
int status;
|
||||
unsigned int flags;
|
||||
gsl_ringbuffer_t *rb = &device->ringbuffer;
|
||||
struct kgsl_ringbuffer *rb = &device->ringbuffer;
|
||||
|
||||
kgsl_log_write( KGSL_LOG_GROUP_COMMAND | KGSL_LOG_LEVEL_TRACE,
|
||||
"--> int kgsl_ringbuffer_init(struct kgsl_device *device=0x%08x)\n", device );
|
||||
@@ -709,7 +710,7 @@ kgsl_ringbuffer_init(struct kgsl_device *device)
|
||||
flags = (GSL_MEMFLAGS_ALIGN32 | GSL_MEMFLAGS_CONPHYS);
|
||||
KGSL_DEBUG(GSL_DBGFLAGS_DUMPX, flags = GSL_MEMFLAGS_ALIGN32);
|
||||
|
||||
status = kgsl_sharedmem_alloc0(device->id, flags, sizeof(gsl_rbmemptrs_t), &rb->memptrs_desc);
|
||||
status = kgsl_sharedmem_alloc0(device->id, flags, sizeof(struct kgsl_rbmemptrs), &rb->memptrs_desc);
|
||||
|
||||
if (status != GSL_SUCCESS)
|
||||
{
|
||||
@@ -719,7 +720,7 @@ kgsl_ringbuffer_init(struct kgsl_device *device)
|
||||
}
|
||||
|
||||
// overlay structure on memptrs memory
|
||||
rb->memptrs = (gsl_rbmemptrs_t *)rb->memptrs_desc.hostptr;
|
||||
rb->memptrs = (struct kgsl_rbmemptrs *)rb->memptrs_desc.hostptr;
|
||||
|
||||
rb->flags |= GSL_FLAGS_INITIALIZED;
|
||||
|
||||
@@ -746,10 +747,10 @@ kgsl_ringbuffer_init(struct kgsl_device *device)
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
int
|
||||
kgsl_ringbuffer_close(gsl_ringbuffer_t *rb)
|
||||
kgsl_ringbuffer_close(struct kgsl_ringbuffer *rb)
|
||||
{
|
||||
kgsl_log_write( KGSL_LOG_GROUP_COMMAND | KGSL_LOG_LEVEL_TRACE,
|
||||
"--> int kgsl_ringbuffer_close(gsl_ringbuffer_t *rb=0x%08x)\n", rb );
|
||||
"--> int kgsl_ringbuffer_close(struct kgsl_ringbuffer *rb=0x%08x)\n", rb );
|
||||
|
||||
#ifdef CONFIG_KGSL_FINE_GRAINED_LOCKING
|
||||
mutex_lock(rb->mutex);
|
||||
@@ -776,7 +777,7 @@ kgsl_ringbuffer_close(gsl_ringbuffer_t *rb)
|
||||
kfree(rb->mutex);
|
||||
#endif
|
||||
|
||||
memset(rb, 0, sizeof(gsl_ringbuffer_t));
|
||||
memset(rb, 0, sizeof(struct kgsl_ringbuffer));
|
||||
|
||||
kgsl_log_write( KGSL_LOG_GROUP_COMMAND | KGSL_LOG_LEVEL_TRACE, "<-- kgsl_ringbuffer_close. Return value %B\n", GSL_SUCCESS );
|
||||
return (GSL_SUCCESS);
|
||||
@@ -787,7 +788,7 @@ kgsl_ringbuffer_close(gsl_ringbuffer_t *rb)
|
||||
unsigned int
|
||||
kgsl_ringbuffer_issuecmds(struct kgsl_device *device, int pmodeoff, unsigned int *cmds, int sizedwords, unsigned int pid)
|
||||
{
|
||||
gsl_ringbuffer_t *rb = &device->ringbuffer;
|
||||
struct kgsl_ringbuffer *rb = &device->ringbuffer;
|
||||
unsigned int pmodesizedwords;
|
||||
unsigned int *ringcmds;
|
||||
unsigned int timestamp;
|
||||
@@ -851,10 +852,10 @@ kgsl_ringbuffer_issuecmds(struct kgsl_device *device, int pmodeoff, unsigned int
|
||||
*ringcmds++ = rb->timestamp;
|
||||
*ringcmds++ = pm4_type3_packet(PM4_EVENT_WRITE, 3);
|
||||
*ringcmds++ = CACHE_FLUSH_TS;
|
||||
*ringcmds++ = device->memstore.gpuaddr + GSL_DEVICE_MEMSTORE_OFFSET(eoptimestamp);
|
||||
*ringcmds++ = device->memstore.gpuaddr + KGSL_DEVICE_MEMSTORE_OFFSET(eoptimestamp);
|
||||
*ringcmds++ = rb->timestamp;
|
||||
|
||||
#if defined GSL_RB_TIMESTAMP_INTERUPT
|
||||
#if defined GSL_RB_TIMESTAMP_INTERUPT
|
||||
*ringcmds++ = pm4_type3_packet(PM4_INTERRUPT, 1);
|
||||
*ringcmds++ = 0x80000000;
|
||||
#endif
|
||||
@@ -878,7 +879,7 @@ int
|
||||
kgsl_ringbuffer_issueibcmds(struct kgsl_device *device, int drawctxt_index, uint32_t ibaddr, int sizedwords, unsigned int *timestamp, unsigned int flags)
|
||||
{
|
||||
unsigned int link[3];
|
||||
gsl_ringbuffer_t *rb = &device->ringbuffer;
|
||||
struct kgsl_ringbuffer *rb = &device->ringbuffer;
|
||||
int dumpx_swap;
|
||||
(void)dumpx_swap; // used only when BB_DUMPX is defined
|
||||
|
||||
@@ -944,7 +945,7 @@ kgsl_ringbuffer_issueibcmds(struct kgsl_device *device, int drawctxt_index, uint
|
||||
|
||||
#ifdef _DEBUG
|
||||
static void
|
||||
kgsl_ringbuffer_debug(gsl_ringbuffer_t *rb, gsl_rb_debug_t *rb_debug)
|
||||
kgsl_ringbuffer_debug(struct kgsl_ringbuffer *rb, gsl_rb_debug_t *rb_debug)
|
||||
{
|
||||
memset(rb_debug, 0, sizeof(gsl_rb_debug_t));
|
||||
|
||||
@@ -973,7 +974,7 @@ kgsl_ringbuffer_debug(gsl_ringbuffer_t *rb, gsl_rb_debug_t *rb_debug)
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
int
|
||||
kgsl_ringbuffer_querystats(gsl_ringbuffer_t *rb, gsl_rbstats_t *stats)
|
||||
kgsl_ringbuffer_querystats(struct kgsl_ringbuffer *rb, struct kgsl_rbstats *stats)
|
||||
{
|
||||
#ifdef GSL_STATS_RINGBUFFER
|
||||
DEBUG_ASSERT(stats);
|
||||
@@ -998,7 +999,7 @@ kgsl_ringbuffer_querystats(gsl_ringbuffer_t *rb, gsl_rbstats_t *stats)
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
int
|
||||
kgsl_ringbuffer_bist(gsl_ringbuffer_t *rb)
|
||||
kgsl_ringbuffer_bist(struct kgsl_ringbuffer *rb)
|
||||
{
|
||||
unsigned int *cmds;
|
||||
unsigned int temp, k, j;
|
||||
@@ -1009,7 +1010,7 @@ kgsl_ringbuffer_bist(gsl_ringbuffer_t *rb)
|
||||
#endif
|
||||
|
||||
kgsl_log_write( KGSL_LOG_GROUP_COMMAND | KGSL_LOG_LEVEL_TRACE,
|
||||
"--> int kgsl_ringbuffer_bist(gsl_ringbuffer_t *rb=0x%08x)\n", rb );
|
||||
"--> int kgsl_ringbuffer_bist(struct kgsl_ringbuffer *rb=0x%08x)\n", rb );
|
||||
|
||||
if (!(rb->flags & GSL_FLAGS_STARTED))
|
||||
{
|
||||
@@ -1170,7 +1171,7 @@ kgsl_ringbuffer_bist(gsl_ringbuffer_t *rb)
|
||||
// rptr memptr validate
|
||||
#endif // GSL_RB_USE_MEM_RPTR
|
||||
|
||||
#ifdef GSL_RB_USE_WPTR_POLLING
|
||||
#ifdef GSL_RB_USE_WPTR_POLLING
|
||||
// wptr memptr validate
|
||||
#endif // GSL_RB_USE_WPTR_POLLING
|
||||
|
||||
|
||||
@@ -30,10 +30,12 @@
|
||||
#define __GSL_RINGBUFFER_H
|
||||
|
||||
// CONFIGURATION ITEMS
|
||||
//#define GSL_STATS_RINGBUFFER
|
||||
#define GSL_RB_USE_MEM_RPTR
|
||||
#define GSL_RB_USE_MEM_TIMESTAMP
|
||||
#define GSL_RB_TIMESTAMP_INTERUPT
|
||||
#define GSL_RB_TIMESTAMP_INTERUPT // not qualcomm!
|
||||
/* #define GSL_RB_USE_WPTR_POLLING */
|
||||
/* #define GSL_DEVICE_SHADOW_MEMSTORE_TO_USER */
|
||||
|
||||
#include "kgsl_types.h"
|
||||
|
||||
@@ -65,8 +67,8 @@
|
||||
#define GSL_RB_SIZE_4M 19
|
||||
|
||||
// offsets into memptrs
|
||||
#define GSL_RB_MEMPTRS_RPTR_OFFSET 0
|
||||
#define GSL_RB_MEMPTRS_WPTRPOLL_OFFSET (GSL_RB_MEMPTRS_RPTR_OFFSET + sizeof(unsigned int))
|
||||
#define GSL_RB_MEMPTRS_RPTR_OFFSET (offsetof(struct kgsl_rbmemptrs, rptr))
|
||||
#define GSL_RB_MEMPTRS_WPTRPOLL_OFFSET (offsetof(struct kgsl_rbmemptrs, wptr_poll))
|
||||
|
||||
// dword base address of the GFX decode space
|
||||
#define GSL_HAL_SUBBLOCK_OFFSET(reg) ((unsigned int)((reg) - (0x2000)))
|
||||
@@ -83,7 +85,7 @@
|
||||
// ----------------
|
||||
// ringbuffer debug
|
||||
// ----------------
|
||||
typedef struct _gsl_rb_debug_t {
|
||||
struct kgsl_rb_debug {
|
||||
unsigned int pm4_ucode_rel;
|
||||
unsigned int pfp_ucode_rel;
|
||||
unsigned int cp_rb_base;
|
||||
@@ -101,16 +103,16 @@ typedef struct _gsl_rb_debug_t {
|
||||
rbbm_status_u rbbm_status;
|
||||
unsigned int sop_timestamp;
|
||||
unsigned int eop_timestamp;
|
||||
} gsl_rb_debug_t;
|
||||
};
|
||||
#endif // _DEBUG
|
||||
|
||||
// -------------------
|
||||
// ringbuffer watchdog
|
||||
// -------------------
|
||||
typedef struct _gsl_rbwatchdog_t {
|
||||
struct kgsl_rbwatchdog {
|
||||
unsigned int flags;
|
||||
unsigned int rptr_sample;
|
||||
} gsl_rbwatchdog_t;
|
||||
};
|
||||
|
||||
// ------------------
|
||||
// memory ptr objects
|
||||
@@ -121,26 +123,26 @@ typedef struct _gsl_rbwatchdog_t {
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
typedef struct _gsl_rbmemptrs_t {
|
||||
struct kgsl_rbmemptrs {
|
||||
volatile int rptr;
|
||||
int wptr_poll;
|
||||
} gsl_rbmemptrs_t;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
// -----
|
||||
// stats
|
||||
// -----
|
||||
typedef struct _gsl_rbstats_t {
|
||||
struct kgsl_rbstats {
|
||||
__s64 wraps;
|
||||
__s64 issues;
|
||||
__s64 wordstotal;
|
||||
} gsl_rbstats_t;
|
||||
};
|
||||
|
||||
|
||||
// -----------------
|
||||
// ringbuffer object
|
||||
// -----------------
|
||||
typedef struct _gsl_ringbuffer_t {
|
||||
struct kgsl_ringbuffer {
|
||||
|
||||
struct kgsl_device *device;
|
||||
unsigned int flags;
|
||||
@@ -148,7 +150,7 @@ typedef struct _gsl_ringbuffer_t {
|
||||
struct kgsl_memdesc buffer_desc; // allocated memory descriptor
|
||||
struct kgsl_memdesc memptrs_desc;
|
||||
|
||||
gsl_rbmemptrs_t *memptrs;
|
||||
struct kgsl_rbmemptrs *memptrs;
|
||||
|
||||
unsigned int sizedwords; // ring buffer size dwords
|
||||
unsigned int blksizequadwords;
|
||||
@@ -158,21 +160,25 @@ typedef struct _gsl_ringbuffer_t {
|
||||
unsigned int timestamp;
|
||||
|
||||
|
||||
gsl_rbwatchdog_t watchdog;
|
||||
struct kgsl_rbwatchdog watchdog;
|
||||
|
||||
#ifdef GSL_STATS_RINGBUFFER
|
||||
gsl_rbstats_t stats;
|
||||
struct kgsl_rbstats stats;
|
||||
#endif // GSL_STATS_RINGBUFFER
|
||||
|
||||
} gsl_ringbuffer_t;
|
||||
};
|
||||
|
||||
|
||||
// ----------
|
||||
// ring write
|
||||
// ----------
|
||||
#define GSL_RB_WRITE(ring, data) \
|
||||
KGSL_DEBUG(GSL_DBGFLAGS_DUMPX, KGSL_DEBUG_DUMPX(BB_DUMP_RINGBUF_WRT, (unsigned int)ring, data, 0, "GSL_RB_WRITE")); \
|
||||
*(unsigned int *)(ring)++ = (unsigned int)(data);
|
||||
#define GSL_RB_WRITE(ring, data) \
|
||||
do { \
|
||||
mb(); \
|
||||
writel(data, ring); \
|
||||
ring++; \
|
||||
} while (0)
|
||||
|
||||
// *(unsigned int *)(ring)++ = (unsigned int)(data);
|
||||
|
||||
// ---------
|
||||
// timestamp
|
||||
@@ -187,7 +193,9 @@ 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, REG_CP_TIMESTAMP, 0);
|
||||
#define GSL_RB_INIT_TIMESTAMP(rb) \
|
||||
kgsl_device_regwrite((rb)->device->id, REG_CP_TIMESTAMP, 0);
|
||||
//qcom: use yamato directly (why do they pass the id?)
|
||||
#endif // GSL_RB_USE_MEMTIMESTAMP
|
||||
|
||||
// --------
|
||||
@@ -195,10 +203,16 @@ typedef struct _gsl_ringbuffer_t {
|
||||
// --------
|
||||
#ifdef GSL_RB_USE_MEM_RPTR
|
||||
#define GSL_RB_CNTL_NO_UPDATE 0x0 // enable
|
||||
#define GSL_RB_GET_READPTR(rb, data) kgsl_sharedmem_read0(&(rb)->memptrs_desc, (data), GSL_RB_MEMPTRS_RPTR_OFFSET, 4, false)
|
||||
#define GSL_RB_GET_READPTR(rb, data) \
|
||||
do { \
|
||||
*(data) = (rb)->memptrs->rptr; \
|
||||
} while (0)
|
||||
#else
|
||||
#define GSL_RB_CNTL_NO_UPDATE 0x1 // disable
|
||||
#define GSL_RB_GET_READPTR(rb, data) (rb)->device->fbtl.device_regread((rb)->device, REG_CP_RB_RPTR,(data))
|
||||
#define GSL_RB_GET_READPTR(rb, data) \
|
||||
do { \
|
||||
(rb)->device->fbtl.device_regread((rb)->device, REG_CP_RB_RPTR,(data)); \
|
||||
} while (0)
|
||||
#endif // GSL_RB_USE_MEMRPTR
|
||||
|
||||
// ------------
|
||||
@@ -206,7 +220,8 @@ typedef struct _gsl_ringbuffer_t {
|
||||
// ------------
|
||||
#ifdef GSL_RB_USE_WPTR_POLLING
|
||||
#define GSL_RB_CNTL_POLL_EN 0x1 // enable
|
||||
#define GSL_RB_UPDATE_WPTR_POLLING(rb) (rb)->memptrs->wptr_poll = (rb)->wptr
|
||||
#define GSL_RB_UPDATE_WPTR_POLLING(rb) \
|
||||
do { (rb)->memptrs->wptr_poll = (rb)->wptr; } while (0)
|
||||
#else
|
||||
#define GSL_RB_CNTL_POLL_EN 0x0 // disable
|
||||
#define GSL_RB_UPDATE_WPTR_POLLING(rb)
|
||||
@@ -226,14 +241,15 @@ typedef struct _gsl_ringbuffer_t {
|
||||
// prototypes
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
int kgsl_ringbuffer_init(struct kgsl_device *device);
|
||||
int kgsl_ringbuffer_close(gsl_ringbuffer_t *rb);
|
||||
int kgsl_ringbuffer_start(gsl_ringbuffer_t *rb);
|
||||
int kgsl_ringbuffer_stop(gsl_ringbuffer_t *rb);
|
||||
unsigned int kgsl_ringbuffer_issuecmds(struct kgsl_device *device, int pmodeoff, unsigned int *cmdaddr, int sizedwords, unsigned int pid);
|
||||
int kgsl_ringbuffer_close(struct kgsl_ringbuffer *rb);
|
||||
int kgsl_ringbuffer_start(struct kgsl_ringbuffer *rb);
|
||||
int kgsl_ringbuffer_stop(struct kgsl_ringbuffer *rb);
|
||||
unsigned int kgsl_ringbuffer_issuecmds(struct kgsl_device *device, int pmodeoff, unsigned int *cmdaddr, int sizedwords, unsigned int pid); //pid is not in qcom
|
||||
int kgsl_ringbuffer_issueibcmds(struct kgsl_device *device, int drawctxt_index, uint32_t ibaddr, int sizedwords, unsigned int *timestamp, unsigned int flags);
|
||||
// qcom: missing int kgsl_ringbuffer_gettimestampshadow(struct kgsl_device *device, unsigned int *sopaddr, unsigned int *eopaddr);
|
||||
void kgsl_ringbuffer_watchdog(void);
|
||||
|
||||
int kgsl_ringbuffer_querystats(gsl_ringbuffer_t *rb, gsl_rbstats_t *stats);
|
||||
int kgsl_ringbuffer_bist(gsl_ringbuffer_t *rb);
|
||||
//qcom: missing void kgsl_cp_intrcallback(struct kgsl_device *device);
|
||||
int kgsl_ringbuffer_querystats(struct kgsl_ringbuffer *rb, struct kgsl_rbstats *stats);
|
||||
int kgsl_ringbuffer_bist(struct kgsl_ringbuffer *rb);
|
||||
|
||||
#endif // __GSL_RINGBUFFER_H
|
||||
|
||||
@@ -308,7 +308,7 @@ struct kgsl_devmemstore {
|
||||
unsigned int sbz2;
|
||||
};
|
||||
|
||||
#define GSL_DEVICE_MEMSTORE_OFFSET(field) offsetof(struct kgsl_devmemstore, field)
|
||||
#define KGSL_DEVICE_MEMSTORE_OFFSET(field) offsetof(struct kgsl_devmemstore, field)
|
||||
|
||||
// -----------
|
||||
// aperture id
|
||||
|
||||
@@ -760,7 +760,7 @@ int
|
||||
kgsl_yamato_idle(struct kgsl_device *device, unsigned int timeout)
|
||||
{
|
||||
int status = GSL_FAILURE;
|
||||
gsl_ringbuffer_t *rb = &device->ringbuffer;
|
||||
struct kgsl_ringbuffer *rb = &device->ringbuffer;
|
||||
unsigned int rbbm_status;
|
||||
|
||||
(void) timeout; // unreferenced formal parameter
|
||||
|
||||
Reference in New Issue
Block a user