https://discuss.haiku-os.org/t/vulkan-lavapipe-software-rendering-is-working-on-haiku/11363?page=13 Haiku Community Vulkan lavapipe software rendering is working on Haiku Development X512 November 28, 2021, 3:37am #244 RadeonGfx use client-server model with client-server thread pairs like in app_server. For each client thread that calls 3D acceleation API, server side thread is created. If client thread terminates, server side thread also exit. I made small library "ThreadLink" that implements client-server thread pair model and simpilfy code. Calling server from client is very simple: port_id gServerPort = find_port("RadeonGfx"); ClientThreadLink *link = GetClientThreadLink(gServerPort); link->Link().StartMessage(radeonMmapMsg); link->Link().Attach((int32)offset); int32 reply; link->Link().FlushWithReply(reply); link->Link().Read(&area); link->Link().Read(&areaOfs); Example of client and server stack when waiting command buffer execution to complete. Client: screenshot54 Server: screenshot55 23 Likes SCollins November 28, 2021, 3:57am #245 When i originally began studying the code and hardware, i noticed that the Radeon driver already sort of had a acclerant design to it. Cool stuff man 2 Likes X512 November 29, 2021, 3:41am #246 I looked at Zink code a bit and it seems possible to replace softpipe driver of existing Haiku Gallium add-on with Zink driver. It use memcpy() to draw surface: static void zink_flush_frontbuffer(struct pipe_screen *pscreen, struct pipe_context *pcontext, struct pipe_resource *pres, unsigned level, unsigned layer, void *winsys_drawable_handle, struct pipe_box *sub_box) { struct zink_screen *screen = zink_screen(pscreen); struct sw_winsys *winsys = screen->winsys; struct zink_resource *res = zink_resource(pres); if (!winsys) return; void *map = winsys->displaytarget_map(winsys, res->dt, 0); if (map) { VkImageSubresource isr = {}; isr.aspectMask = res->aspect; isr.mipLevel = level; isr.arrayLayer = layer; VkSubresourceLayout layout; vkGetImageSubresourceLayout(screen->dev, res->image, &isr, &layout); void *ptr; VkResult result = vkMapMemory(screen->dev, res->mem, res->offset, res->size, 0, &ptr); if (result != VK_SUCCESS) { debug_printf("failed to map memory for display\n"); return; } for (int i = 0; i < pres->height0; ++i) { uint8_t *src = (uint8_t *)ptr + i * layout.rowPitch; uint8_t *dst = (uint8_t *)map + i * res->dt_stride; memcpy(dst, src, res->dt_stride); } vkUnmapMemory(screen->dev, res->mem); } winsys->displaytarget_unmap(winsys, res->dt); assert(res->dt); if (res->dt) winsys->displaytarget_display(winsys, res->dt, winsys_drawable_handle, sub_box); } 18 Likes X512 November 29, 2021, 11:58am #247 And this works. Blender is working with OpenGL over Zink. No modifications were made to Haiku Gallium addon except changing driver to Zink. screenshot61 28 Likes X512 November 29, 2021, 12:13pm #248 screenshot62 22 Likes SWY1985 November 29, 2021, 12:15pm #249 How is the performance in Blender? You're doing amazing things, thank you! 1 Like X512 November 29, 2021, 12:17pm #250 Not so good for now. In addition to GFX ring problem it probably currently use inoptimal video buffer configuration. 1 Like leavengood split this topic November 29, 2021, 7:41pm #251 9 posts were split to a new topic: AMD Laptops for Haiku (moved from Vulkan lavapipe...) X512 November 29, 2021, 12:28pm #252 screenshot63 13 Likes rudolfc November 29, 2021, 7:45pm #253 Nice! as usual :wink: Would be cool if it would become possible to render on the same card that displays the desktop at some point. Do you have plans for that yet, do you foresee difficulties, or am I just asking a bit too early? :innocent: 3 Likes amonpaike November 29, 2021, 10:24pm #254 there is some kind of opengl fps test in blender, maybe it can help you to see performance differences... from the search menu in blender, type "debug menu" and then enter "21" there are other debugging option for opengl here in this video: [hqdefault] 1 Like X512 November 29, 2021, 10:28pm #255 After fixing buffer stride alignment problem, multiple windows in Blender, window resizing and GLTeapot are working. There are currently problem with efficiency in Zink and RadeonGfx in server mode that it clone and delete buffer on each frame that is time consuming. screenshot66 26 Likes cosmogatokat November 30, 2021, 2:30am #256 Now wiil be a great oportunity to test Godot Engine demos too n,n BTW Godot Engine 4 Alfa have a vulkan engine. 2 Likes X512 November 30, 2021, 11:38am #257 Zink over Lavapipe also works, but with glitches (no cube in Blender) and crashes. screenshot68 12 Likes bitigchi November 30, 2021, 11:52am #258 https://news.ycombinator.com/item?id=29390689 4 Likes extrowerk November 30, 2021, 12:03pm #259 Ah those expected standard "Nice, and i would use IF..." comments. 4 Likes bitigchi November 30, 2021, 12:06pm #260 Shall we update the title? It's more than software rendering at this point. X512 November 30, 2021, 12:08pm #261 Maybe better to split when I started to write about implementing stub libdrm for RADV. 6 Likes amonpaike November 30, 2021, 4:00pm #262 # phoronix.com [image] Haiku OS Managing To Run Zink OpenGL Atop Radeon Vulkan Driver For 3D... Last month we reported on progress for porting the Mesa Radeon Vulkan driver to Haiku, the BeOS-inspired open-source operating system 11 Likes X512 November 30, 2021, 8:40pm #263 I think that article don't clarify what things were ported and what were written from scratch. Ported: 1. LavaPipe (remove dependency on DRM) 2. RADV (small changes to solve header conflicts and weak symbols) 3. Zink (no changes to Zink itself, switching from softpipe to zink in Haiku Gallium add-on) 4. libdrm_amdgpu (no changes) 5. libvulkan (compile fixes) 6. Vulkan WSI add-on (implementing Haiku window over headless surface, very incomplete for now) Written: 1. libdrm2 (partially-compatible with libdrm, provides only render devices, no KMS related functionality, interacts with RadeonGfx) 2. RadeonGfx (low-level driver interacting with GPU hardware. Functional alternative of Linux amdgpu kernel mode. Runs fully in userland as separate server process over existing Haiku radeon_hd kernel driver.) 3. Various helper libraries: Locks, SADomains, Poke, ExternalAllocator, ThreadLink. 11 Likes - previous page next page - * Home * Categories * FAQ/Guidelines * Terms of Service * Privacy Policy Powered by Discourse, best viewed with JavaScript enabled