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 27, 2024
1 parent affd358 commit a338a7f
Show file tree
Hide file tree
Showing 14 changed files with 63 additions and 3 deletions.
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
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
10 changes: 9 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 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;
}
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
8 changes: 8 additions & 0 deletions src/vulkan/wsi/wsi_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,19 +361,22 @@ configure_image(const struct wsi_swapchain *chain,
{
switch (params->image_type) {
case WSI_IMAGE_TYPE_CPU: {
printf(">>>> MESA::configure_image::WSI_IMAGE_TYPE_CPU\n");
const struct wsi_cpu_image_params *cpu_params =
container_of(params, const struct wsi_cpu_image_params, base);
return wsi_configure_cpu_image(chain, pCreateInfo, cpu_params, info);
}
#ifdef HAVE_LIBDRM
case WSI_IMAGE_TYPE_DRM: {
printf(">>>> MESA::configure_image::WSI_IMAGE_TYPE_DRM\n");
const struct wsi_drm_image_params *drm_params =
container_of(params, const struct wsi_drm_image_params, base);
return wsi_drm_configure_image(chain, pCreateInfo, drm_params, info);
}
#endif
#ifdef _WIN32
case WSI_IMAGE_TYPE_DXGI: {
printf(">>>> MESA::configure_image::WSI_IMAGE_TYPE_DXGI\n");
const struct wsi_dxgi_image_params *dxgi_params =
container_of(params, const struct wsi_dxgi_image_params, base);
return wsi_dxgi_configure_image(chain, pCreateInfo, dxgi_params, info);
Expand Down Expand Up @@ -1764,13 +1767,15 @@ wsi_create_buffer_blit_context(const struct wsi_swapchain *chain,
};
__vk_append_struct(&buf_mem_info, &memory_export_info);
}
printf(">>>> MESA::wsi_create_buffer_blit_context\n");
#ifndef _WIN32
VkImportMemoryFdInfoKHR memory_fd_info;

if (info->display_device_is_virtgpu)
{
int fd = 0;

printf(">>>> MESA::wsi_create_buffer_blit_context::virtgpu_alloc_and_export\n");
fd = virtgpu_alloc_and_export(info->display_device_fd, info->linear_stride, info->linear_size);
memory_fd_info = (VkImportMemoryFdInfoKHR){
.sType = VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR,
Expand Down Expand Up @@ -2090,6 +2095,7 @@ wsi_create_cpu_buffer_image_mem(const struct wsi_swapchain *chain,
{
VkResult result;

printf(">>>> MESA::wsi_create_cpu_buffer_image_mem::wsi_create_buffer_blit_context\n");
result = wsi_create_buffer_blit_context(chain, info, image, 0,
false /* implicit_sync */);
if (result != VK_SUCCESS)
Expand Down Expand Up @@ -2136,6 +2142,7 @@ wsi_configure_cpu_image(const struct wsi_swapchain *chain,
return result;

if (chain->blit.type != WSI_SWAPCHAIN_NO_BLIT) {
printf(">>>> MESA::wsi_configure_cpu_image::wsi_create_cpu_buffer_image_mem\n");
wsi_configure_buffer_image(chain, pCreateInfo,
1 /* stride_align */,
1 /* size_align */,
Expand All @@ -2145,6 +2152,7 @@ wsi_configure_cpu_image(const struct wsi_swapchain *chain,
info->select_image_memory_type = wsi_select_device_memory_type;
info->create_mem = wsi_create_cpu_buffer_image_mem;
} else {
printf(">>>> MESA::wsi_configure_cpu_image::wsi_create_cpu_linear_image_mem\n");
/* Force the image to be linear */
info->create.tiling = VK_IMAGE_TILING_LINEAR;

Expand Down
1 change: 1 addition & 0 deletions src/vulkan/wsi/wsi_common_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -2113,6 +2113,7 @@ wsi_display_surface_create_swapchain(
return VK_ERROR_OUT_OF_HOST_MEMORY;
}

printf(">>>> MESA::wsi_display_surface_create_swapchain::wsi_swapchain_init\n");
VkResult result = wsi_swapchain_init(wsi_device, &chain->base, device,
create_info, &image_params.base,
allocator);
Expand Down
4 changes: 4 additions & 0 deletions src/vulkan/wsi/wsi_common_drm.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,7 @@ wsi_create_prime_image_mem(const struct wsi_swapchain *chain,
const struct wsi_image_info *info,
struct wsi_image *image)
{
printf(">>>> MESA::wsi_create_prime_image_mem::wsi_create_buffer_blit_context\n");
VkResult result =
wsi_create_buffer_blit_context(chain, info, image,
VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT,
Expand All @@ -741,6 +742,9 @@ wsi_create_prime_image_mem(const struct wsi_swapchain *chain,
image->drm_modifier = info->prime_use_linear_modifier ?
DRM_FORMAT_MOD_LINEAR : DRM_FORMAT_MOD_INVALID;

if(image->drm_modifier == DRM_FORMAT_MOD_LINEAR)
printf(">>>> MESA::wsi_create_prime_image_mem::DRM_FORMAT_MOD_LINEAR\n");

return VK_SUCCESS;
}

Expand Down
1 change: 1 addition & 0 deletions src/vulkan/wsi/wsi_common_headless.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ wsi_headless_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
.same_gpu = true,
};

printf(">>>> MESA::wsi_headless_surface_create_swapchain::wsi_swapchain_init\n");
result = wsi_swapchain_init(wsi_device, &chain->base, device,
pCreateInfo, &drm_params.base, pAllocator);
if (result != VK_SUCCESS) {
Expand Down
1 change: 1 addition & 0 deletions src/vulkan/wsi/wsi_common_wayland.c
Original file line number Diff line number Diff line change
Expand Up @@ -2352,6 +2352,7 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
image_params = &drm_image_params.base;
}

printf(">>>> MESA::wsi_wl_surface_create_swapchain::wsi_swapchain_init\n");
result = wsi_swapchain_init(wsi_device, &chain->base, device,
pCreateInfo, image_params, pAllocator);
if (result != VK_SUCCESS)
Expand Down
1 change: 1 addition & 0 deletions src/vulkan/wsi/wsi_common_x11.c
Original file line number Diff line number Diff line change
Expand Up @@ -2500,6 +2500,7 @@ x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
image_params = &drm_image_params.base;
}

printf(">>>> MESA::x11_surface_create_swapchain::wsi_swapchain_init\n");
result = wsi_swapchain_init(wsi_device, &chain->base, device, pCreateInfo,
image_params, pAllocator);

Expand Down

0 comments on commit a338a7f

Please sign in to comment.