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:
@@ -588,6 +588,8 @@ NineBaseTexture9_PreLoad( struct NineBaseTexture9 *This )
|
|||||||
void
|
void
|
||||||
NineBaseTexture9_UnLoad( struct NineBaseTexture9 *This )
|
NineBaseTexture9_UnLoad( struct NineBaseTexture9 *This )
|
||||||
{
|
{
|
||||||
|
DBG("This=%p\n", This);
|
||||||
|
|
||||||
if (This->base.pool != D3DPOOL_MANAGED ||
|
if (This->base.pool != D3DPOOL_MANAGED ||
|
||||||
This->managed.lod_resident == -1)
|
This->managed.lod_resident == -1)
|
||||||
return;
|
return;
|
||||||
|
@@ -358,6 +358,7 @@ NineBuffer9_Lock( struct NineBuffer9 *This,
|
|||||||
This->maps[This->nmaps].buf = This->buf;
|
This->maps[This->nmaps].buf = This->buf;
|
||||||
This->nmaps++;
|
This->nmaps++;
|
||||||
This->nlocks++;
|
This->nlocks++;
|
||||||
|
DBG("Returning %p\n", nine_upload_buffer_get_map(This->buf) + OffsetToLock);
|
||||||
*ppbData = nine_upload_buffer_get_map(This->buf) + OffsetToLock;
|
*ppbData = nine_upload_buffer_get_map(This->buf) + OffsetToLock;
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -205,7 +205,7 @@ NineUnknown_SetPrivateData( struct NineUnknown *This,
|
|||||||
|
|
||||||
/* data consists of a header and the actual data. avoiding 2 mallocs */
|
/* data consists of a header and the actual data. avoiding 2 mallocs */
|
||||||
header = CALLOC_VARIANT_LENGTH_STRUCT(pheader, SizeOfData);
|
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;
|
header->unknown = (Flags & D3DSPD_IUNKNOWN) ? TRUE : FALSE;
|
||||||
|
|
||||||
/* if the refguid already exists, delete it */
|
/* 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_data, user_data, header->size);
|
||||||
memcpy(&header->guid, refguid, sizeof(header->guid));
|
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);
|
_mesa_hash_table_insert(This->pdata, &header->guid, header);
|
||||||
if (header->unknown) { IUnknown_AddRef(*(IUnknown **)header_data); }
|
if (header->unknown) { IUnknown_AddRef(*(IUnknown **)header_data); }
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
@@ -245,22 +246,26 @@ NineUnknown_GetPrivateData( struct NineUnknown *This,
|
|||||||
(void)guid_str;
|
(void)guid_str;
|
||||||
|
|
||||||
header = util_hash_table_get(This->pdata, refguid);
|
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);
|
user_assert(pSizeOfData, E_POINTER);
|
||||||
sizeofdata = *pSizeOfData;
|
sizeofdata = *pSizeOfData;
|
||||||
*pSizeOfData = header->size;
|
*pSizeOfData = header->size;
|
||||||
|
DBG("Found header %p, size %d. Requested max %d\n", header, (int)header->size, (int)sizeofdata);
|
||||||
|
|
||||||
if (!pData) {
|
if (!pData) {
|
||||||
|
DBG("Returning early D3D_OK\n");
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
if (sizeofdata < header->size) {
|
if (sizeofdata < header->size) {
|
||||||
|
DBG("Returning D3DERR_MOREDATA\n");
|
||||||
return D3DERR_MOREDATA;
|
return D3DERR_MOREDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
header_data = (void *)header + sizeof(*header);
|
header_data = (void *)header + sizeof(*header);
|
||||||
if (header->unknown) { IUnknown_AddRef(*(IUnknown **)header_data); }
|
if (header->unknown) { IUnknown_AddRef(*(IUnknown **)header_data); }
|
||||||
memcpy(pData, header_data, header->size);
|
memcpy(pData, header_data, header->size);
|
||||||
|
DBG("Returning D3D_OK\n");
|
||||||
|
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
@@ -277,9 +282,12 @@ NineUnknown_FreePrivateData( struct NineUnknown *This,
|
|||||||
(void)guid_str;
|
(void)guid_str;
|
||||||
|
|
||||||
header = util_hash_table_get(This->pdata, refguid);
|
header = util_hash_table_get(This->pdata, refguid);
|
||||||
if (!header)
|
if (!header) {
|
||||||
|
DBG("Nothing to free\n");
|
||||||
return D3DERR_NOTFOUND;
|
return D3DERR_NOTFOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
DBG("Freeing %p\n", header);
|
||||||
ht_guid_delete(NULL, header, NULL);
|
ht_guid_delete(NULL, header, NULL);
|
||||||
_mesa_hash_table_remove_key(This->pdata, refguid);
|
_mesa_hash_table_remove_key(This->pdata, refguid);
|
||||||
|
|
||||||
|
@@ -75,7 +75,7 @@ nine_upload_create_buffer_group(struct nine_buffer_upload *upload,
|
|||||||
{
|
{
|
||||||
struct pipe_resource resource;
|
struct pipe_resource resource;
|
||||||
struct pipe_screen *screen = upload->pipe->screen;
|
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));
|
memset(&resource, 0, sizeof(resource));
|
||||||
resource.target = PIPE_BUFFER;
|
resource.target = PIPE_BUFFER;
|
||||||
@@ -107,6 +107,7 @@ nine_upload_create_buffer_group(struct nine_buffer_upload *upload,
|
|||||||
}
|
}
|
||||||
|
|
||||||
group->free_offset = 0;
|
group->free_offset = 0;
|
||||||
|
DBG("Success: %p %p\n", group->map, group->map+upload->buffers_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -114,6 +115,7 @@ nine_upload_destroy_buffer_group(struct nine_buffer_upload *upload,
|
|||||||
struct nine_buffer_group *group)
|
struct nine_buffer_group *group)
|
||||||
{
|
{
|
||||||
DBG("%p %p\n", upload, group);
|
DBG("%p %p\n", upload, group);
|
||||||
|
DBG("Release: %p %p\n", group->map, group->map+upload->buffers_size);
|
||||||
assert(group->refcount == 0);
|
assert(group->refcount == 0);
|
||||||
|
|
||||||
if (group->transfer)
|
if (group->transfer)
|
||||||
@@ -279,6 +281,7 @@ uint8_t *
|
|||||||
nine_upload_buffer_get_map(struct nine_subbuffer *buf)
|
nine_upload_buffer_get_map(struct nine_subbuffer *buf)
|
||||||
{
|
{
|
||||||
if (buf->parent) {
|
if (buf->parent) {
|
||||||
|
DBG("%d\n", buf->parent->refcount);
|
||||||
return buf->parent->map + buf->offset;
|
return buf->parent->map + buf->offset;
|
||||||
}
|
}
|
||||||
/* lonely buffer */
|
/* lonely buffer */
|
||||||
|
@@ -359,6 +359,7 @@ NineSurface9_GetDesc( struct NineSurface9 *This,
|
|||||||
D3DSURFACE_DESC *pDesc )
|
D3DSURFACE_DESC *pDesc )
|
||||||
{
|
{
|
||||||
user_assert(pDesc != NULL, E_POINTER);
|
user_assert(pDesc != NULL, E_POINTER);
|
||||||
|
DBG("This=%p pDesc=%p\n", This, pDesc);
|
||||||
*pDesc = This->desc;
|
*pDesc = This->desc;
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
@@ -494,7 +495,6 @@ NineSurface9_LockRect( struct NineSurface9 *This,
|
|||||||
stride = This->stride_internal;
|
stride = This->stride_internal;
|
||||||
data = This->data_internal;
|
data = This->data_internal;
|
||||||
}
|
}
|
||||||
DBG("returning system memory\n");
|
|
||||||
/* ATI1 and ATI2 need special handling, because of d3d9 bug.
|
/* ATI1 and ATI2 need special handling, because of d3d9 bug.
|
||||||
* We must advertise to the application as if it is uncompressed
|
* 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
|
* 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.x,
|
||||||
box.y);
|
box.y);
|
||||||
}
|
}
|
||||||
|
DBG("returning system memory %p\n", pLockedRect->pBits);
|
||||||
} else {
|
} else {
|
||||||
bool no_refs = !p_atomic_read(&This->base.base.bind) &&
|
bool no_refs = !p_atomic_read(&This->base.base.bind) &&
|
||||||
!(This->base.base.container && p_atomic_read(&This->base.base.container->bind));
|
!(This->base.base.container && p_atomic_read(&This->base.base.container->bind));
|
||||||
|
@@ -243,6 +243,7 @@ NineTexture9_GetLevelDesc( struct NineTexture9 *This,
|
|||||||
DBG("This=%p Level=%d pDesc=%p\n", This, Level, pDesc);
|
DBG("This=%p Level=%d pDesc=%p\n", This, Level, pDesc);
|
||||||
|
|
||||||
user_assert(Level < This->base.level_count, D3DERR_INVALIDCALL);
|
user_assert(Level < This->base.level_count, D3DERR_INVALIDCALL);
|
||||||
|
user_assert(pDesc, D3DERR_INVALIDCALL);
|
||||||
|
|
||||||
*pDesc = This->surfaces[Level]->desc;
|
*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);
|
DBG("This=%p Level=%d ppSurfaceLevel=%p\n", This, Level, ppSurfaceLevel);
|
||||||
|
|
||||||
user_assert(Level < This->base.level_count, D3DERR_INVALIDCALL);
|
user_assert(Level < This->base.level_count, D3DERR_INVALIDCALL);
|
||||||
|
user_assert(ppSurfaceLevel, D3DERR_INVALIDCALL);
|
||||||
|
|
||||||
NineUnknown_AddRef(NineUnknown(This->surfaces[Level]));
|
NineUnknown_AddRef(NineUnknown(This->surfaces[Level]));
|
||||||
*ppSurfaceLevel = (IDirect3DSurface9 *)This->surfaces[Level];
|
*ppSurfaceLevel = (IDirect3DSurface9 *)This->surfaces[Level];
|
||||||
|
Reference in New Issue
Block a user