Wrap xdg in IVI shell

Teyfel, Michael (ADITG/ESB) mteyfel at de.adit-jv.com
Wed Feb 21 08:39:51 UTC 2018


Hi Stuvart,

thank you for your question. At the moment it is not possible to use xdg shell protocol applications within ivi-shell. Some time ago I published patches to enable xdg shell protocol support to ivi shell. Please find my presentation from the AGL AMM last year covering that topic.  These patches are already used by AGL. Unfortunately they are not mainline in weston and wayland-ivi-extension yet, but I can provide you the patch set on my github.


https://github.com/mtey/wayland-ivi-extension/tree/xdg_support_ivi_id_agent

https://github.com/mtey/weston/tree/xdg_support_ivi_id_agent

With these patches and by configuring the reference ivi-id-agent implementation correctly (see commit message), you can natively run your xdg protocol application. Have fun!

Btw are you aware of this ML: genivi-ivi-layer-management at lists.genivi.org<mailto:genivi-ivi-layer-management at lists.genivi.org> ? It is the community maintaining the ivi-shell and its features within Genivi.


Cheers,
Michael

Best regards

Michael Teyfel
Advanced Driver Information Technology GmbH
Engineering Software Base (ADITG/ESB)
Robert-Bosch-Str. 200
31139 Hildesheim
Germany
Tel. +49 5121 49 6932
Fax +49 5121 49 6999
mteyfel at de.adit-jv.com
ADIT is a joint venture company of Robert Bosch GmbH/Robert Bosch Car Multimedia GmbH and DENSO Corporation
Sitz: Hildesheim, Registergericht: Amtsgericht Hildesheim HRB 3438
Geschäftsführung: Wilhelm Grabow, Ken Yaguchi
From: wayland-devel [mailto:wayland-devel-bounces at lists.freedesktop.org] On Behalf Of Stuvart S
Sent: Mittwoch, 21. Februar 2018 05:31
To: wayland-devel at lists.freedesktop.org
Subject: Wrap xdg in IVI shell

Hi team,

I wrote a user app which is capable of displaying a surface. It works perfectly on xdg shell ,but when switching to ivi shell it doesn,t. I could know that there are differences in protocols,thats why it happens and there is one way that we can wrap xdg in ivi shell.But I am not aware of doing that.

Following are the code snipet that works for me in xdg..(tested in raspberry pi )
Does anybody have any clue ? Any help is appreciated..
Thanks in advance.


#include <stdio.h>
#include <string.h>

#include <syscall.h>
#include <unistd.h>
#include <sys/mman.h>

#include <wayland-client.h>
#include <wayland-client-core.h>


struct wl_compositor *compositor;
struct wl_shm *shm;
struct wl_shell *shell;

void registry_global_handler
(
    void *data,
    struct wl_registry *registry,
    uint32_t name,
    const char *interface,
    uint32_t version
) {
    if (strcmp(interface, "wl_compositor") == 0) {
        compositor = wl_registry_bind(registry, name,
            &wl_compositor_interface, 3);
    } else if (strcmp(interface, "wl_shm") == 0) {
        shm = wl_registry_bind(registry, name,
            &wl_shm_interface, 1);
    } else if (strcmp(interface, "wl_shell") == 0) {
        shell = wl_registry_bind(registry, name,
            &wl_shell_interface, 1);
    }
}

void registry_global_remove_handler
(
    void *data,
    struct wl_registry *registry,
    uint32_t name
) {}

const struct wl_registry_listener registry_listener = {
    .global = registry_global_handler,
    .global_remove = registry_global_remove_handler
};

int main(void)
{
    struct wl_display *display = wl_display_connect(NULL);
    struct wl_registry *registry = wl_display_get_registry(display);
    wl_registry_add_listener(registry, &registry_listener, NULL);

    // wait for the "initial" set of globals to appear
    wl_display_roundtrip(display);

    struct wl_surface *surface = wl_compositor_create_surface(compositor);
    struct wl_shell_surface *shell_surface = wl_shell_get_shell_surface(shell, surface);
    wl_shell_surface_set_toplevel(shell_surface);

    int width = 108;
    int height = 192;
    int stride = width * 4;
    int size = stride * height;  // bytes

    // open an anonymous file and write some zero bytes to it
    int fd = syscall(SYS_memfd_create, "buffer", 0);
    ftruncate(fd, size);

    // map it to the memory
    unsigned char *data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
   int temp=0;

struct wl_shm_pool *pool = wl_shm_create_pool(shm, fd, size);

    // allocate the buffer in that pool
    struct wl_buffer *buffer = wl_shm_pool_create_buffer(pool,
        0, width, height, stride, WL_SHM_FORMAT_ARGB8888);

    wl_surface_attach(surface, buffer, 0, 0);



while(1){
printf("%d\n",temp);
temp++;
for (int x = 0; x < width; x++) {
    for (int y = 0; y < height; y++) {

        struct pixel {
            // little-endian ARGB
            unsigned char blue;
            unsigned char green;
            unsigned char red;
            unsigned char alpha;
        } *px = (struct pixel *) (data + y * stride + x * 4);

        // yellow
        px->alpha = 255;
                  if(temp >100)
    {
     px->red = 100;
        px->green = 0;
         px->blue = 0;

    }
    else
    {

        px->red = 0;
        px->green = 100;
        px->blue = 0;
        //if(y==(height/2))
        //break;
        }
    }
}


usleep(50*1000);
    // turn it into a shared memory pool
 wl_surface_commit(surface);
     wl_display_flush(display);
/* wl_display_destroy(display);*/



    }
}

Cheers,
Stuvart

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20180221/19456e34/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: AGL_AMM_XDG_Shell_Support_Michael_Teyfel.pdf
Type: application/pdf
Size: 362382 bytes
Desc: AGL_AMM_XDG_Shell_Support_Michael_Teyfel.pdf
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20180221/19456e34/attachment-0001.pdf>


More information about the wayland-devel mailing list