st/nine: Add new debug and error checks

Add new debug messages and error checks

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9177>
This commit is contained in:
Axel Davy 2020-05-21 16:55:19 +02:00
parent 1a53099909
commit 501ad0e134
6 changed files with 22 additions and 5 deletions

View File

@ -588,6 +588,8 @@ NineBaseTexture9_PreLoad( struct NineBaseTexture9 *This )
void
NineBaseTexture9_UnLoad( struct NineBaseTexture9 *This )
{
DBG("This=%p\n", This);
if (This->base.pool != D3DPOOL_MANAGED ||
This->managed.lod_resident == -1)
return;

View File

@ -358,6 +358,7 @@ NineBuffer9_Lock( struct NineBuffer9 *This,
This->maps[This->nmaps].buf = This->buf;
This->nmaps++;
This->nlocks++;
DBG("Returning %p\n", nine_upload_buffer_get_map(This->buf) + OffsetToLock);
*ppbData = nine_upload_buffer_get_map(This->buf) + OffsetToLock;
return D3D_OK;
} else {

View File

@ -205,7 +205,7 @@ NineUnknown_SetPrivateData( struct NineUnknown *This,
/* data consists of a header and the actual data. avoiding 2 mallocs */
header = CALLOC_VARIANT_LENGTH_STRUCT(pheader, SizeOfData);
if (!header) { return E_OUTOFMEMORY; }
if (!header) { DBG("Returning E_OUTOFMEMORY\n"); return E_OUTOFMEMORY; }
header->unknown = (Flags & D3DSPD_IUNKNOWN) ? TRUE : FALSE;
/* if the refguid already exists, delete it */
@ -223,6 +223,7 @@ NineUnknown_SetPrivateData( struct NineUnknown *This,
memcpy(header_data, user_data, header->size);
memcpy(&header->guid, refguid, sizeof(header->guid));
DBG("New header %p, size %d\n", header, (int)header->size);
_mesa_hash_table_insert(This->pdata, &header->guid, header);
if (header->unknown) { IUnknown_AddRef(*(IUnknown **)header_data); }
return D3D_OK;
@ -245,22 +246,26 @@ NineUnknown_GetPrivateData( struct NineUnknown *This,
(void)guid_str;
header = util_hash_table_get(This->pdata, refguid);
if (!header) { return D3DERR_NOTFOUND; }
if (!header) { DBG("Returning D3DERR_NOTFOUND\n"); return D3DERR_NOTFOUND; }
user_assert(pSizeOfData, E_POINTER);
sizeofdata = *pSizeOfData;
*pSizeOfData = header->size;
DBG("Found header %p, size %d. Requested max %d\n", header, (int)header->size, (int)sizeofdata);
if (!pData) {
DBG("Returning early D3D_OK\n");
return D3D_OK;
}
if (sizeofdata < header->size) {
DBG("Returning D3DERR_MOREDATA\n");
return D3DERR_MOREDATA;
}
header_data = (void *)header + sizeof(*header);
if (header->unknown) { IUnknown_AddRef(*(IUnknown **)header_data); }
memcpy(pData, header_data, header->size);
DBG("Returning D3D_OK\n");
return D3D_OK;
}
@ -277,9 +282,12 @@ NineUnknown_FreePrivateData( struct NineUnknown *This,
(void)guid_str;
header = util_hash_table_get(This->pdata, refguid);
if (!header)
if (!header) {
DBG("Nothing to free\n");
return D3DERR_NOTFOUND;
}
DBG("Freeing %p\n", header);
ht_guid_delete(NULL, header, NULL);
_mesa_hash_table_remove_key(This->pdata, refguid);

View File

@ -75,7 +75,7 @@ nine_upload_create_buffer_group(struct nine_buffer_upload *upload,
{
struct pipe_resource resource;
struct pipe_screen *screen = upload->pipe->screen;
DBG("%p %p\n", upload, group);
DBG("Allocating %p %p\n", upload, group);
memset(&resource, 0, sizeof(resource));
resource.target = PIPE_BUFFER;
@ -107,6 +107,7 @@ nine_upload_create_buffer_group(struct nine_buffer_upload *upload,
}
group->free_offset = 0;
DBG("Success: %p %p\n", group->map, group->map+upload->buffers_size);
}
static void
@ -114,6 +115,7 @@ nine_upload_destroy_buffer_group(struct nine_buffer_upload *upload,
struct nine_buffer_group *group)
{
DBG("%p %p\n", upload, group);
DBG("Release: %p %p\n", group->map, group->map+upload->buffers_size);
assert(group->refcount == 0);
if (group->transfer)
@ -279,6 +281,7 @@ uint8_t *
nine_upload_buffer_get_map(struct nine_subbuffer *buf)
{
if (buf->parent) {
DBG("%d\n", buf->parent->refcount);
return buf->parent->map + buf->offset;
}
/* lonely buffer */

View File

@ -359,6 +359,7 @@ NineSurface9_GetDesc( struct NineSurface9 *This,
D3DSURFACE_DESC *pDesc )
{
user_assert(pDesc != NULL, E_POINTER);
DBG("This=%p pDesc=%p\n", This, pDesc);
*pDesc = This->desc;
return D3D_OK;
}
@ -494,7 +495,6 @@ NineSurface9_LockRect( struct NineSurface9 *This,
stride = This->stride_internal;
data = This->data_internal;
}
DBG("returning system memory\n");
/* ATI1 and ATI2 need special handling, because of d3d9 bug.
* We must advertise to the application as if it is uncompressed
* and bpp 8, and the app has a workaround to work with the fact
@ -510,6 +510,7 @@ NineSurface9_LockRect( struct NineSurface9 *This,
box.x,
box.y);
}
DBG("returning system memory %p\n", pLockedRect->pBits);
} else {
bool no_refs = !p_atomic_read(&This->base.base.bind) &&
!(This->base.base.container && p_atomic_read(&This->base.base.container->bind));

View File

@ -243,6 +243,7 @@ NineTexture9_GetLevelDesc( struct NineTexture9 *This,
DBG("This=%p Level=%d pDesc=%p\n", This, Level, pDesc);
user_assert(Level < This->base.level_count, D3DERR_INVALIDCALL);
user_assert(pDesc, D3DERR_INVALIDCALL);
*pDesc = This->surfaces[Level]->desc;
@ -257,6 +258,7 @@ NineTexture9_GetSurfaceLevel( struct NineTexture9 *This,
DBG("This=%p Level=%d ppSurfaceLevel=%p\n", This, Level, ppSurfaceLevel);
user_assert(Level < This->base.level_count, D3DERR_INVALIDCALL);
user_assert(ppSurfaceLevel, D3DERR_INVALIDCALL);
NineUnknown_AddRef(NineUnknown(This->surfaces[Level]));
*ppSurfaceLevel = (IDirect3DSurface9 *)This->surfaces[Level];