Skip to content

Commit

Permalink
Added Debug logs
Browse files Browse the repository at this point in the history
Change-Id: Ie48186a54a76e8b258cb14c60b3f2ba53be46597
  • Loading branch information
disantkumar committed May 28, 2024
1 parent affd358 commit b59c557
Show file tree
Hide file tree
Showing 22 changed files with 77 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/egl/drivers/dri2/egl_dri2.c
Original file line number Diff line number Diff line change
Expand Up @@ -2900,6 +2900,7 @@ dri2_create_drm_image_mesa(_EGLDisplay *disp, const EGLint *attr_list)

_eglInitImage(&dri2_img->base, disp);

printf(">>>> MESA::dri2_create_drm_image_mesa::dri2_dpy->image->createImage\n");
dri2_img->dri_image =
dri2_dpy->image->createImage(dri2_dpy->dri_screen_render_gpu, attrs.Width,
attrs.Height, format, dri_use, dri2_img);
Expand Down
1 change: 1 addition & 0 deletions src/egl/drivers/dri2/platform_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ static __DRIimage *
device_alloc_image(struct dri2_egl_display *dri2_dpy,
struct dri2_egl_surface *dri2_surf)
{
printf(">>>> MESA::device_alloc_image::dri2_dpy->image->createImage\n");
return dri2_dpy->image->createImage(
dri2_dpy->dri_screen_render_gpu, dri2_surf->base.Width,
dri2_surf->base.Height, dri2_surf->visual, 0, NULL);
Expand Down
1 change: 1 addition & 0 deletions src/egl/drivers/dri2/platform_drm.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
unsigned flags = surf->base.v0.flags;
if (dri2_surf->base.ProtectedContent)
flags |= GBM_BO_USE_PROTECTED;
printf(">>>>> mesa::get_back_bo\n");
dri2_surf->back->bo =
gbm_bo_create(&dri2_dpy->gbm_dri->base, surf->base.v0.width,
surf->base.v0.height, surf->base.v0.format, flags);
Expand Down
1 change: 1 addition & 0 deletions src/egl/drivers/dri2/platform_surfaceless.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ static __DRIimage *
surfaceless_alloc_image(struct dri2_egl_display *dri2_dpy,
struct dri2_egl_surface *dri2_surf)
{
printf(">>>> MESA::surfaceless_alloc_image::dri2_dpy->image->createImage\n");
return dri2_dpy->image->createImage(
dri2_dpy->dri_screen_render_gpu, dri2_surf->base.Width,
dri2_surf->base.Height, dri2_surf->visual, 0, NULL);
Expand Down
4 changes: 4 additions & 0 deletions src/gallium/auxiliary/target-helpers/drm_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,18 @@ pipe_virtio_gpu_create_screen(int fd, const struct pipe_screen_config *config)
{
struct pipe_screen *screen = NULL;

printf(">>>> MESA::pipe_virtio_gpu_create_screen\n");
/* Try native guest driver(s) first, and then fallback to virgl: */
#ifdef GALLIUM_FREEDRENO
if (!screen)
screen = fd_drm_screen_create_renderonly(fd, NULL, config);
#endif
#ifdef GALLIUM_VIRGL
if (!screen)
{
printf(">>>> MESA::pipe_virtio_gpu_create_screen::virgl_drm_screen_create\n");
screen = virgl_drm_screen_create(fd, config);
}
#endif
return screen ? debug_screen_wrap(screen) : NULL;
}
Expand Down
5 changes: 5 additions & 0 deletions src/gallium/auxiliary/vl/vl_winsys_dri3.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ dri3_alloc_back_buffer(struct vl_dri3_screen *scrn)
struct pipe_resource templ, *pixmap_buffer_texture;
struct winsys_handle whandle;

printf(">>>> MESA::dri3_alloc_back_buffer\n");
buffer = CALLOC_STRUCT(vl_dri3_buffer);
if (!buffer)
return NULL;
Expand All @@ -262,20 +263,23 @@ dri3_alloc_back_buffer(struct vl_dri3_screen *scrn)
templ.array_size = 1;

if (scrn->is_different_gpu) {
printf(">>>> MESA::dri3_alloc_back_buffer::resource_create::is_different_gpu\n");
buffer->texture = (scrn->output_texture) ? scrn->output_texture :
scrn->base.pscreen->resource_create(scrn->base.pscreen, &templ);
if (!buffer->texture)
goto unmap_shm;

templ.bind |= PIPE_BIND_SCANOUT | PIPE_BIND_SHARED |
PIPE_BIND_LINEAR;
printf(">>>> MESA::dri3_alloc_back_buffer::resource_create::is_different_gpu::PIPE_BIND_SCANOUT/SHARED/LINEAR\n");
buffer->linear_texture =
scrn->base.pscreen->resource_create(scrn->base.pscreen, &templ);
pixmap_buffer_texture = buffer->linear_texture;

if (!buffer->linear_texture)
goto no_linear_texture;
} else {
printf(">>>> MESA::dri3_alloc_back_buffer::resource_create::else\n");
templ.bind |= PIPE_BIND_SCANOUT | PIPE_BIND_SHARED;
buffer->texture = (scrn->output_texture) ? scrn->output_texture :
scrn->base.pscreen->resource_create(scrn->base.pscreen, &templ);
Expand Down Expand Up @@ -311,6 +315,7 @@ dri3_alloc_back_buffer(struct vl_dri3_screen *scrn)

xshmfence_trigger(buffer->shm_fence);

printf(">>>> MESA::dri3_alloc_back_buffer::returned\n");
return buffer;

no_linear_texture:
Expand Down
8 changes: 8 additions & 0 deletions src/gallium/drivers/virgl/virgl_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ virgl_resource_realloc(struct virgl_context *vctx, struct virgl_resource *res)

int alloc_size = res->use_staging ? 1 : res->metadata.total_size;

printf(">>>> MESA::virgl_resource_realloc::resource_create\n");
hw_res = vs->vws->resource_create(vs->vws,
templ->target,
NULL,
Expand Down Expand Up @@ -617,9 +618,11 @@ static void virgl_resource_layout(struct pipe_resource *pt,

nblocksy = util_format_get_nblocksy(pt->format, height);
if ((pt->bind & (PIPE_BIND_SCANOUT | PIPE_BIND_SHARED)) == (PIPE_BIND_SCANOUT | PIPE_BIND_SHARED)) {
printf(">>>> MESA::virgl_resource_layout::PIPE_BIND_SCANOUT/SHARED\n");
/* Shared scanout buffers need to be aligned to 256 bytes */
metadata->stride[level] = ALIGN(util_format_get_stride(pt->format, width), 256);
} else {
printf(">>>> MESA::virgl_resource_layout::else\n");
metadata->stride[level] = winsys_stride ? winsys_stride :
util_format_get_stride(pt->format, width);
}
Expand Down Expand Up @@ -677,6 +680,7 @@ static struct pipe_resource *virgl_resource_create_front(struct pipe_screen *scr
else
alloc_size = res->metadata.total_size;

printf(">>>> MESA::virgl_resource_create_front::vs->vws->resource_create\n");
res->hw_res = vs->vws->resource_create(vs->vws, templ->target,
map_front_private,
templ->format, vbind,
Expand All @@ -702,13 +706,15 @@ static struct pipe_resource *virgl_resource_create_front(struct pipe_screen *scr
virgl_texture_init(res);
}

printf(">>>> MESA::virgl_resource_create_front::done\n");
return &res->b;

}

static struct pipe_resource *virgl_resource_create(struct pipe_screen *screen,
const struct pipe_resource *templ)
{
printf(">>>> MESA::%pS::virgl_resource_create::virgl_resource_create_front\n",__builtin_return_address(0));
return virgl_resource_create_front(screen, templ, NULL);
}

Expand All @@ -732,6 +738,7 @@ static struct pipe_resource *virgl_resource_from_handle(struct pipe_screen *scre
pipe_reference_init(&res->b.reference, 1);

plane = winsys_stride = plane_offset = modifier = 0;
printf(">>>> MESA::virgl_resource_from_handle::resource_create_from_handle\n");
res->hw_res = vs->vws->resource_create_from_handle(vs->vws, whandle,
&res->b,
&plane,
Expand All @@ -752,6 +759,7 @@ static struct pipe_resource *virgl_resource_from_handle(struct pipe_screen *scre
modifier = 0;
}

printf(">>>> MESA::virgl_resource_from_handle::virgl_resource_layout\n");
virgl_resource_layout(&res->b, &res->metadata, plane, winsys_stride,
plane_offset, modifier);

Expand Down
1 change: 1 addition & 0 deletions src/gallium/drivers/virgl/virgl_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,7 @@ static void virgl_query_memory_info(struct pipe_screen *screen, struct pipe_memo
.flags = 0
};

printf(">>>> MESA::virgl_query_memory_info::screen->resource_create\n");
res = (struct virgl_resource*) screen->resource_create(screen, &templ);

virgl_encode_get_memory_info(vctx, res);
Expand Down
1 change: 1 addition & 0 deletions src/gallium/drivers/virgl/virgl_staging_mgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ virgl_staging_alloc_buffer(struct virgl_staging_mgr *staging, unsigned min_size)
*/
size = align(MAX2(staging->default_size, min_size), 4096);

printf(">>>> MESA::virgl_staging_alloc_buffer::vws->resource_create\n");
staging->hw_res = vws->resource_create(vws,
PIPE_BUFFER,
NULL,
Expand Down
1 change: 1 addition & 0 deletions src/gallium/drivers/virgl/virgl_texture.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ static void *texture_transfer_map_resolve(struct pipe_context *ctx,

virgl_init_temp_resource_from_box(&templ, resource, &dst_box, level, 0, fmt);

printf(">>>> MESA::texture_transfer_map_resolve::ctx->screen->resource_create\n");
resolve_tmp = ctx->screen->resource_create(ctx->screen, &templ);
if (!resolve_tmp)
return NULL;
Expand Down
13 changes: 12 additions & 1 deletion src/gallium/frontends/dri/dri2.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ dri2_allocate_buffer(struct dri_screen *screen,
templ.depth0 = 1;
templ.array_size = 1;

printf(">>>> MESA::dri2_allocate_buffer::screen->base.screen->resource_create\n");
buffer->resource =
screen->base.screen->resource_create(screen->base.screen, &templ);
if (!buffer->resource) {
Expand Down Expand Up @@ -639,6 +640,7 @@ dri2_allocate_textures(struct dri_context *ctx,
/* Allocate a new one. */
pipe_resource_reference(&drawable->msaa_textures[statt], NULL);

printf(">>>> MESA::dri2_allocate_textures::screen->base.screen->resource_create\n");
drawable->msaa_textures[statt] =
screen->base.screen->resource_create(screen->base.screen,
&templ);
Expand Down Expand Up @@ -697,6 +699,7 @@ dri2_allocate_textures(struct dri_context *ctx,
(*zsbuf)->height0 != templ.height0) {
/* Allocate a new one. */
pipe_resource_reference(zsbuf, NULL);
printf(">>>> MESA::dri2_allocate_textures::screen->base.screen->resource_create2\n");
*zsbuf = screen->base.screen->resource_create(screen->base.screen,
&templ);
assert(*zsbuf);
Expand Down Expand Up @@ -1251,15 +1254,20 @@ dri2_create_image_common(__DRIscreen *_screen,
templ.array_size = 1;

if (modifiers)
{
printf(">>>> MESA::dri2_create_image_common::screen->base.screen->resource_create_with_modifiers\n");
img->texture =
screen->base.screen
->resource_create_with_modifiers(screen->base.screen,
&templ,
modifiers,
count);
else
}else
{
printf(">>>> MESA::dri2_create_image_common::screen->base.screen->resource_create\n");
img->texture =
screen->base.screen->resource_create(screen->base.screen, &templ);
}
if (!img->texture) {
FREE(img);
return NULL;
Expand All @@ -1283,6 +1291,7 @@ dri2_create_image(__DRIscreen *_screen,
int width, int height, int format,
unsigned int use, void *loaderPrivate)
{
printf(">>>> MESA::dri2_create_image::dri2_create_image_common\n");
return dri2_create_image_common(_screen, width, height, format, use,
NULL /* modifiers */, 0 /* count */,
loaderPrivate);
Expand All @@ -1295,6 +1304,7 @@ dri2_create_image_with_modifiers(__DRIscreen *dri_screen,
const unsigned count,
void *loaderPrivate)
{
printf(">>>> MESA::dri2_create_image_with_modifiers::dri2_create_image_common\n");
return dri2_create_image_common(dri_screen, width, height, format,
__DRI_IMAGE_USE_SHARE, modifiers, count,
loaderPrivate);
Expand All @@ -1307,6 +1317,7 @@ dri2_create_image_with_modifiers2(__DRIscreen *dri_screen,
const unsigned count, unsigned int use,
void *loaderPrivate)
{
printf(">>>> MESA::dri2_create_image_with_modifiers2::dri2_create_image_common\n");
return dri2_create_image_common(dri_screen, width, height, format, use,
modifiers, count, loaderPrivate);
}
Expand Down
1 change: 1 addition & 0 deletions src/gallium/frontends/dri/drisw.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ drisw_allocate_textures(struct dri_context *stctx,
if (statts[i] == ST_ATTACHMENT_FRONT_LEFT &&
screen->base.screen->resource_create_front &&
loader->base.version >= 3) {
printf(">>>> MESA::drisw_allocate_textures::screen->base.screen->resource_create_front\n");
drawable->textures[statts[i]] =
screen->base.screen->resource_create_front(screen->base.screen, &templ, (const void *)drawable);
} else
Expand Down
18 changes: 16 additions & 2 deletions src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,22 +558,32 @@ virgl_drm_winsys_resource_cache_create(struct virgl_winsys *qws,
if (target == PIPE_BUFFER && (bind & VIRGL_BIND_CUSTOM))
need_sync = true;


if ((bind & (VIRGL_BIND_SCANOUT | VIRGL_BIND_SHARED)) == (VIRGL_BIND_SCANOUT | VIRGL_BIND_SHARED))
{
printf(">>>> MESA::virgl_drm_winsys_resource_cache_create::create_shared_scanout\n");
res = virgl_drm_winsys_resource_create_shared_scanout(qws, target, format, bind,
width, height, depth,
array_size, last_level,
nr_samples, flags, size);
else if (flags & (VIRGL_RESOURCE_FLAG_MAP_PERSISTENT |
}
else
if (flags & (VIRGL_RESOURCE_FLAG_MAP_PERSISTENT |
VIRGL_RESOURCE_FLAG_MAP_COHERENT))
{
printf(">>>> MESA::virgl_drm_winsys_resource_cache_create::blob\n");
res = virgl_drm_winsys_resource_create_blob(qws, target, format, bind,
width, height, depth,
array_size, last_level,
nr_samples, flags, size);
}
else
{ printf(">>>> MESA::virgl_drm_winsys_resource_cache_create::else\n");
res = virgl_drm_winsys_resource_create(qws, target, format, bind, width,
height, depth, array_size,
last_level, nr_samples, size,
need_sync);
}
return res;
}

Expand Down Expand Up @@ -1337,7 +1347,7 @@ virgl_drm_winsys_create(int drmFD)
struct virgl_drm_winsys *qdws;
int drm_version;
int ret;

printf(">>>> MESA::virgl_drm_winsys_create\n");
for (uint32_t i = 0; i < ARRAY_SIZE(params); i++) {
struct drm_virtgpu_getparam getparam = { 0 };
uint64_t value = 0;
Expand Down Expand Up @@ -1406,6 +1416,7 @@ virgl_drm_winsys_create(int drmFD)

qdws->base.supports_coherent = params[param_resource_blob].value &&
params[param_host_visible].value;
printf(">>>> MESA::virgl_drm_winsys_create::return\n");
return &qdws->base;

}
Expand Down Expand Up @@ -1476,6 +1487,7 @@ virgl_drm_screen_create(int fd, const struct pipe_screen_config *config)
{
struct pipe_screen *pscreen = NULL;

printf(">>>> MESA::virgl_drm_screen_create\n");
simple_mtx_lock(&virgl_screen_mutex);
if (!fd_tab) {
fd_tab = _mesa_hash_table_create(NULL, hash_fd, equal_fd);
Expand All @@ -1490,6 +1502,7 @@ virgl_drm_screen_create(int fd, const struct pipe_screen_config *config)
struct virgl_winsys *vws;
int dup_fd = os_dupfd_cloexec(fd);

printf(">>>> MESA::virgl_drm_screen_create::virgl_drm_winsys_create\n");
vws = virgl_drm_winsys_create(dup_fd);
if (!vws) {
close(dup_fd);
Expand All @@ -1511,5 +1524,6 @@ virgl_drm_screen_create(int fd, const struct pipe_screen_config *config)

unlock:
simple_mtx_unlock(&virgl_screen_mutex);
printf(">>>> MESA::virgl_drm_screen_create::return\n");
return pscreen;
}
4 changes: 4 additions & 0 deletions src/loader/loader_dri3_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -1520,6 +1520,7 @@ dri3_alloc_render_buffer(struct loader_dri3_drawable *draw, unsigned int format,
free(mod_reply);
}
#endif
printf(">>>> MESA::dri3_alloc_render_buffer::loader_dri_create_image\n");
buffer->image = loader_dri_create_image(draw->dri_screen_render_gpu, draw->ext->image,
width, height, format,
__DRI_IMAGE_USE_SHARE |
Expand All @@ -1535,6 +1536,7 @@ dri3_alloc_render_buffer(struct loader_dri3_drawable *draw, unsigned int format,
if (!buffer->image)
goto no_image;
} else {
printf(">>>> MESA::dri3_alloc_render_buffer::else::draw->ext->image->createImage\n");
buffer->image = draw->ext->image->createImage(draw->dri_screen_render_gpu,
width, height,
format,
Expand All @@ -1549,6 +1551,7 @@ dri3_alloc_render_buffer(struct loader_dri3_drawable *draw, unsigned int format,
* is also used for display gpu.
*/
if (draw->dri_screen_display_gpu) {
printf(">>>> MESA::dri3_alloc_render_buffer::else::dri_screen_display_gpu::draw->ext->image->createImage\n");
linear_buffer_display_gpu =
draw->ext->display_image->createImage(draw->dri_screen_display_gpu,
width, height,
Expand All @@ -1565,6 +1568,7 @@ dri3_alloc_render_buffer(struct loader_dri3_drawable *draw, unsigned int format,
}

if (!pixmap_buffer) {
printf(">>>> MESA::dri3_alloc_render_buffer::else::!pixmap_buffer::draw->ext->image->createImage\n");
image_ext = draw->ext->image;
buffer->linear_buffer =
draw->ext->image->createImage(draw->dri_screen_render_gpu,
Expand Down
1 change: 1 addition & 0 deletions src/loader/loader_dri_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ __DRIimage *loader_dri_create_image(__DRIscreen *screen,
modifiers_count, loaderPrivate);
}

printf(">>>> MESA::loader_dri_create_image::image->createImage\n");
/* No modifier given or fallback to the legacy createImage allowed */
return image->createImage(screen, width, height, dri_format, dri_usage,
loaderPrivate);
Expand Down
3 changes: 3 additions & 0 deletions src/virtio/vulkan/vn_renderer_virtgpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1634,6 +1634,7 @@ virtgpu_open(struct virtgpu *gpu)
static VkResult
virtgpu_init(struct virtgpu *gpu)
{
printf(">>>> MESA::virtgpu_init\n");
util_sparse_array_init(&gpu->shmem_array, sizeof(struct virtgpu_shmem),
1024);
util_sparse_array_init(&gpu->bo_array, sizeof(struct virtgpu_bo), 1024);
Expand Down Expand Up @@ -1681,6 +1682,7 @@ virtgpu_init(struct virtgpu *gpu)
gpu->base.sync_ops.read = virtgpu_sync_read;
gpu->base.sync_ops.write = virtgpu_sync_write;

printf(">>>> MESA::virtgpu_init::end\n");
return VK_SUCCESS;
}

Expand All @@ -1697,6 +1699,7 @@ vn_renderer_create_virtgpu(struct vn_instance *instance,
gpu->instance = instance;
gpu->fd = -1;

printf(">>>> MESA::vn_renderer_create_virtgpu::virtgpu_init\n");
VkResult result = virtgpu_init(gpu);
if (result != VK_SUCCESS) {
virtgpu_destroy(&gpu->base, alloc);
Expand Down
Loading

0 comments on commit b59c557

Please sign in to comment.