mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-04 00:30:11 +01:00
svga: add DEBUG_CACHE option
This commit is contained in:
parent
69671df74c
commit
b911688b87
8 changed files with 53 additions and 9 deletions
|
|
@ -43,6 +43,7 @@
|
|||
#define DEBUG_FLUSH 0x1000 /* flush after every draw */
|
||||
#define DEBUG_SYNC 0x2000 /* sync after every flush */
|
||||
#define DEBUG_QUERY 0x4000
|
||||
#define DEBUG_CACHE 0x8000
|
||||
|
||||
#ifdef DEBUG
|
||||
extern int SVGA_DEBUG;
|
||||
|
|
|
|||
|
|
@ -29,10 +29,13 @@
|
|||
#include "util/u_memory.h"
|
||||
#include "util/u_math.h"
|
||||
|
||||
#include "svga_context.h"
|
||||
#include "svga_draw.h"
|
||||
#include "svga_draw_private.h"
|
||||
#include "svga_debug.h"
|
||||
#include "svga_screen.h"
|
||||
#include "svga_screen_buffer.h"
|
||||
#include "svga_screen_texture.h"
|
||||
#include "svga_winsys.h"
|
||||
#include "svga_cmd.h"
|
||||
|
||||
|
|
@ -160,6 +163,10 @@ svga_hwtnl_flush( struct svga_hwtnl *hwtnl )
|
|||
ib_handle[i] = handle;
|
||||
}
|
||||
|
||||
SVGA_DBG(DEBUG_DMA, "draw to sid %p, %d prims\n",
|
||||
svga_surface(svga->curr.framebuffer.cbufs[0])->handle,
|
||||
hwtnl->cmd.prim_count);
|
||||
|
||||
ret = SVGA3D_BeginDrawPrimitives(swc,
|
||||
&vdecl,
|
||||
hwtnl->cmd.vdecl_count,
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "svga_screen_texture.h"
|
||||
#include "svga_context.h"
|
||||
#include "svga_debug.h"
|
||||
#include "svga_cmd.h"
|
||||
|
||||
#define FILE_DEBUG_FLAG DEBUG_BLIT
|
||||
|
|
@ -43,6 +44,13 @@ static void svga_surface_copy(struct pipe_context *pipe,
|
|||
|
||||
svga_hwtnl_flush_retry( svga );
|
||||
|
||||
SVGA_DBG(DEBUG_DMA, "blit to sid %p (%d,%d), from sid %p (%d,%d) sz %dx%d\n",
|
||||
svga_surface(dest)->handle,
|
||||
destx, desty,
|
||||
svga_surface(src)->handle,
|
||||
srcx, srcy,
|
||||
width, height);
|
||||
|
||||
ret = SVGA3D_BeginSurfaceCopy(svga->swc,
|
||||
src,
|
||||
dest,
|
||||
|
|
|
|||
|
|
@ -24,12 +24,14 @@
|
|||
**********************************************************/
|
||||
|
||||
#include "svga_cmd.h"
|
||||
#include "svga_debug.h"
|
||||
|
||||
#include "pipe/p_defines.h"
|
||||
#include "util/u_pack_color.h"
|
||||
|
||||
#include "svga_context.h"
|
||||
#include "svga_state.h"
|
||||
#include "svga_screen_texture.h"
|
||||
|
||||
|
||||
static enum pipe_error
|
||||
|
|
@ -98,6 +100,10 @@ svga_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
|
|||
{
|
||||
struct svga_context *svga = svga_context( pipe );
|
||||
int ret;
|
||||
|
||||
if (buffers & PIPE_CLEAR_COLOR)
|
||||
SVGA_DBG(DEBUG_DMA, "clear sid %p\n",
|
||||
svga_surface(svga->curr.framebuffer.cbufs[0])->handle);
|
||||
|
||||
ret = try_clear( svga, buffers, rgba, depth, stencil );
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,9 @@ static void svga_flush( struct pipe_context *pipe,
|
|||
/* Flush command queue.
|
||||
*/
|
||||
svga_context_flush(svga, fence);
|
||||
|
||||
SVGA_DBG(DEBUG_DMA|DEBUG_PERF, "%s flags %x fence_ptr %p\n",
|
||||
__FUNCTION__, flags, fence ? *fence : 0x0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ static const struct debug_named_value svga_debug_flags[] = {
|
|||
{ "perf", DEBUG_PERF },
|
||||
{ "flush", DEBUG_FLUSH },
|
||||
{ "sync", DEBUG_SYNC },
|
||||
{ "cache", DEBUG_CACHE },
|
||||
{NULL, 0}
|
||||
};
|
||||
#endif
|
||||
|
|
@ -297,6 +298,10 @@ svga_fence_finish(struct pipe_screen *screen,
|
|||
unsigned flag)
|
||||
{
|
||||
struct svga_winsys_screen *sws = svga_screen(screen)->sws;
|
||||
|
||||
SVGA_DBG(DEBUG_DMA|DEBUG_PERF, "%s fence_ptr %p\n",
|
||||
__FUNCTION__, fence);
|
||||
|
||||
return sws->fence_finish(sws, fence, flag);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -447,7 +447,7 @@ svga_buffer_map_range( struct pipe_screen *screen,
|
|||
enum pipe_error ret;
|
||||
struct pipe_fence_handle *fence = NULL;
|
||||
|
||||
SVGA_DBG(DEBUG_DMA|DEBUG_PERF, "dma from sid %p, bytes %u - %u\n",
|
||||
SVGA_DBG(DEBUG_DMA|DEBUG_PERF, "dma from sid %p (buffer), bytes %u - %u\n",
|
||||
sbuf->handle, 0, sbuf->base.size);
|
||||
|
||||
memset(&flags, 0, sizeof flags);
|
||||
|
|
|
|||
|
|
@ -134,7 +134,8 @@ svga_screen_cache_add(struct svga_screen *svgascreen,
|
|||
else if(!LIST_IS_EMPTY(&cache->unused)) {
|
||||
/* free the last used buffer and reuse its entry */
|
||||
entry = LIST_ENTRY(struct svga_host_surface_cache_entry, cache->unused.prev, head);
|
||||
SVGA_DBG(DEBUG_DMA, "unref sid %p (make space)\n", entry->handle);
|
||||
SVGA_DBG(DEBUG_CACHE|DEBUG_DMA,
|
||||
"unref sid %p (make space)\n", entry->handle);
|
||||
sws->surface_reference(sws, &entry->handle, NULL);
|
||||
|
||||
LIST_DEL(&entry->bucket_head);
|
||||
|
|
@ -146,11 +147,14 @@ svga_screen_cache_add(struct svga_screen *svgascreen,
|
|||
entry->handle = handle;
|
||||
memcpy(&entry->key, key, sizeof entry->key);
|
||||
|
||||
SVGA_DBG(DEBUG_CACHE|DEBUG_DMA,
|
||||
"cache sid %p\n", entry->handle);
|
||||
LIST_ADD(&entry->head, &cache->validated);
|
||||
}
|
||||
else {
|
||||
/* Couldn't cache the buffer -- this really shouldn't happen */
|
||||
SVGA_DBG(DEBUG_DMA, "unref sid %p (couldn't find space)\n", handle);
|
||||
SVGA_DBG(DEBUG_CACHE|DEBUG_DMA,
|
||||
"unref sid %p (couldn't find space)\n", handle);
|
||||
sws->surface_reference(sws, &handle, NULL);
|
||||
}
|
||||
|
||||
|
|
@ -209,7 +213,8 @@ svga_screen_cache_cleanup(struct svga_screen *svgascreen)
|
|||
|
||||
for(i = 0; i < SVGA_HOST_SURFACE_CACHE_SIZE; ++i) {
|
||||
if(cache->entries[i].handle) {
|
||||
SVGA_DBG(DEBUG_DMA, "unref sid %p (shutdown)\n", cache->entries[i].handle);
|
||||
SVGA_DBG(DEBUG_CACHE|DEBUG_DMA,
|
||||
"unref sid %p (shutdown)\n", cache->entries[i].handle);
|
||||
sws->surface_reference(sws, &cache->entries[i].handle, NULL);
|
||||
}
|
||||
|
||||
|
|
@ -252,7 +257,8 @@ svga_screen_surface_create(struct svga_screen *svgascreen,
|
|||
struct svga_winsys_surface *handle = NULL;
|
||||
boolean cachable = SVGA_SURFACE_CACHE_ENABLED && key->cachable;
|
||||
|
||||
SVGA_DBG(DEBUG_DMA, "%s sz %dx%dx%d mips %d faces %d cachable %d\n",
|
||||
SVGA_DBG(DEBUG_CACHE|DEBUG_DMA,
|
||||
"%s sz %dx%dx%d mips %d faces %d cachable %d\n",
|
||||
__FUNCTION__,
|
||||
key->size.width,
|
||||
key->size.height,
|
||||
|
|
@ -276,10 +282,12 @@ svga_screen_surface_create(struct svga_screen *svgascreen,
|
|||
handle = svga_screen_cache_lookup(svgascreen, key);
|
||||
if (handle) {
|
||||
if (key->format == SVGA3D_BUFFER)
|
||||
SVGA_DBG(DEBUG_DMA, " reuse sid %p sz %d (buffer)\n", handle,
|
||||
SVGA_DBG(DEBUG_CACHE|DEBUG_DMA,
|
||||
"reuse sid %p sz %d (buffer)\n", handle,
|
||||
key->size.width);
|
||||
else
|
||||
SVGA_DBG(DEBUG_DMA, " reuse sid %p sz %dx%dx%d mips %d faces %d\n", handle,
|
||||
SVGA_DBG(DEBUG_CACHE|DEBUG_DMA,
|
||||
"reuse sid %p sz %dx%dx%d mips %d faces %d\n", handle,
|
||||
key->size.width,
|
||||
key->size.height,
|
||||
key->size.depth,
|
||||
|
|
@ -296,7 +304,12 @@ svga_screen_surface_create(struct svga_screen *svgascreen,
|
|||
key->numFaces,
|
||||
key->numMipLevels);
|
||||
if (handle)
|
||||
SVGA_DBG(DEBUG_DMA, "create sid %p sz %d\n", handle, key->size);
|
||||
SVGA_DBG(DEBUG_CACHE|DEBUG_DMA,
|
||||
" CREATE sid %p sz %dx%dx%d\n",
|
||||
handle,
|
||||
key->size.width,
|
||||
key->size.height,
|
||||
key->size.depth);
|
||||
}
|
||||
|
||||
return handle;
|
||||
|
|
@ -318,7 +331,8 @@ svga_screen_surface_destroy(struct svga_screen *svgascreen,
|
|||
svga_screen_cache_add(svgascreen, key, p_handle);
|
||||
}
|
||||
else {
|
||||
SVGA_DBG(DEBUG_DMA, "unref sid %p (uncachable)\n", *p_handle);
|
||||
SVGA_DBG(DEBUG_DMA,
|
||||
"unref sid %p (uncachable)\n", *p_handle);
|
||||
sws->surface_reference(sws, p_handle, NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue