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 30, 2024
1 parent affd358 commit 0beb411
Show file tree
Hide file tree
Showing 24 changed files with 87 additions and 4 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/egl/drivers/dri2/platform_wayland.c
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,7 @@ create_dri_image_from_dmabuf_feedback(struct dri2_egl_surface *dri2_surf,
if (tranche->flags & ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT)
flags |= __DRI_IMAGE_USE_SCANOUT;

printf(">>>> MESA::create_dri_image_from_dmabuf_feedback::loader_dri_create_image\n");
dri2_surf->back->dri_image = loader_dri_create_image(
dri2_dpy->dri_screen_render_gpu, dri2_dpy->image,
dri2_surf->base.Width, dri2_surf->base.Height, pipe_format,
Expand Down Expand Up @@ -969,6 +970,7 @@ create_dri_image(struct dri2_egl_surface *dri2_surf,
/* If our DRIImage implementation does not support createImageWithModifiers,
* then fall back to the old createImage, and hope it allocates an image
* which is acceptable to the winsys. */
printf(">>>> MESA::create_dri_image::loader_dri_create_image\n");
dri2_surf->back->dri_image = loader_dri_create_image(
dri2_dpy->dri_screen_render_gpu, dri2_dpy->image, dri2_surf->base.Width,
dri2_surf->base.Height, pipe_format,
Expand Down Expand Up @@ -1052,6 +1054,7 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
__DRIimage *linear_copy_display_gpu_image = NULL;

if (dri2_dpy->dri_screen_display_gpu) {
printf(">>>> MESA::get_back_bo::dri_screen_display_gpu::loader_dri_create_image\n");
linear_copy_display_gpu_image = loader_dri_create_image(
dri2_dpy->dri_screen_display_gpu, dri2_dpy->image,
dri2_surf->base.Width, dri2_surf->base.Height,
Expand Down Expand Up @@ -1137,6 +1140,7 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
}

if (!dri2_surf->back->linear_copy) {
printf(">>>> MESA::get_back_bo::!dri2_surf->back->linear_copy::loader_dri_create_image\n");
dri2_surf->back->linear_copy = loader_dri_create_image(
dri2_dpy->dri_screen_render_gpu, dri2_dpy->image,
dri2_surf->base.Width, dri2_surf->base.Height,
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
7 changes: 7 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 Down Expand Up @@ -709,6 +713,7 @@ static struct pipe_resource *virgl_resource_create_front(struct pipe_screen *scr
static struct pipe_resource *virgl_resource_create(struct pipe_screen *screen,
const struct pipe_resource *templ)
{
printf(">>>> MESA::virgl_resource_create::virgl_resource_create_front\n");
return virgl_resource_create_front(screen, templ, NULL);
}

Expand All @@ -732,6 +737,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 +758,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::format::0x%x ::bind::0x%x\n",format,bind);
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::format::0x%x ::bind::0x%x\n",format,bind);
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::0x%x ::bind::0x%x\n",format,bind);
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;
}
1 change: 1 addition & 0 deletions src/gbm/backends/dri/gbm_dri.c
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,7 @@ gbm_dri_bo_create(struct gbm_device *gbm,
goto failed;
}

printf(">>>> MESA::gbm_dri_bo_create::loader_dri_create_image\n");
bo->image = loader_dri_create_image(dri->screen, dri->image, width, height,
dri_format, dri_use, modifiers, count,
bo);
Expand Down
Loading

0 comments on commit 0beb411

Please sign in to comment.