Re: [wayland + ILM] proxy wrappers usage of wayland 1.11.0 to 1.9.0

2017-08-25 Thread Philipp Kerling
Hi,

2017-08-21 (月) の 11:05 +0530 に Vikas Patil さんは書きました:
> Thanks a lot Philipp for your comments, it really helped. Now I get
> the display correctly. However now I get the segmentation at
> different
> location with my uses case [1] after back porting patches from
> wayland
> 1.11.0 to 1.9.0 and and also utilizing proxy wrappers in ILM control
> library.
> 
> (gdb) bt
> #0  0x68d11554 in wl_array_copy (array=0x67d2eb98, source=0x1) at
> /usr/src/debug/wayland/1.9.0-r0/wayland-1.9.0/src/wayland-util.c:145
> #1  0x in ?? ()
> Backtrace stopped: previous frame identical to this frame (corrupt
> stack?)
I don't think anyone will be able to help you with this backtrace as
you can't see what's happening at all. You will first have to try to
determine where exactly and for what reason the erroneous call to
wl_array_copy (second parameter is clearly invalid) happens.

- Philipp

> 
> [1] https://lists.freedesktop.org/archives/wayland-devel/2017-August/
> 
> Thanks & Regards,
> Vikash
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [wayland + ILM] proxy wrappers usage of wayland 1.11.0 to 1.9.0

2017-08-20 Thread Vikas Patil
Thanks a lot Philipp for your comments, it really helped. Now I get
the display correctly. However now I get the segmentation at different
location with my uses case [1] after back porting patches from wayland
1.11.0 to 1.9.0 and and also utilizing proxy wrappers in ILM control
library.

(gdb) bt
#0  0x68d11554 in wl_array_copy (array=0x67d2eb98, source=0x1) at
/usr/src/debug/wayland/1.9.0-r0/wayland-1.9.0/src/wayland-util.c:145
#1  0x in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)


[1] https://lists.freedesktop.org/archives/wayland-devel/2017-August/

Thanks & Regards,
Vikash

On Fri, Aug 18, 2017 at 7:35 PM, Philipp Kerling  wrote:
> Hi,
>
> Am Freitag, den 18.08.2017, 18:35 +0530 schrieb Vikas Patil:
>> Dear All,
>>
>>
>> I have backported following patches from wayland 1.11.0 to 1.9.0 to
>> test one crash issue [1] . I am able to backport and start Weston
>> with
>> it. Is this valid thing to do?
>>
>>
>> https://cgit.freedesktop.org/wayland/wayland/commit/?id=6d29c0da3cd16
>> 8e08187cd204d2314188479c0f1
>> [client: Introduce proxy wrappers]
>>
>> https://cgit.freedesktop.org/wayland/wayland/commit/?id=6fe12f02e3b48
>> 79cd3d5faa08f023cc761d13be9
>> [client: Fix wl_display_roundtrip_queue() race condition]
>>
>> https://cgit.freedesktop.org/wayland/wayland/commit/?id=69ec70fb0d3f7
>> 5f4bcce449238d6297f6a986b5f
>> [tests/queue-test: Add tests for proxy wrappers] -- not required.
>>
>>
>>
>> Now If I understand it correctly I need to use/modify code where the
>> wayland client creates the proxy and sets the queue. One such
>> components is [2] ILM control library. I tried to do as per the
>> patches but with it nothing is coming on display even though weston
>> starts successfully with ivi-shell and ivi-controller.so.
>>
>>
>> Attached here the modified file. I would like to understand if the
>> way I used is correct or not? Could someone explain this fix and How
>> to use it properly for ILM control library? Do I need to add similar
>> fix in qtwayland  5.5.1 and other such components (e.g. wayland sink
>> from gstreamer) ?
> I think there are some problems judging by a quick look at your file:
>  * You create a wrapper for the wl_display, but then call
>wl_display_get_registry on your original display. You need to use
>the wrapped display here.
>  * Consequently, you must set the queue on the wl_display wrapper
>before that so it correctly gets inherited to the wl_registry.
>  * I don't understand what you use wl_display_sync for. You do know
>that wl_display_roundtrip_queue uses that implicitly?
>  * You must add the registry listener immediately after creating it and
>not dispatch any events (on the queue the registry uses) in between.
>Otherwise they will get lost.
>
> You might want to take a look at how other libraries use the API, e.g.
> https://github.com/01org/libva/blob/master/va/wayland/va_wayland_drm.c#L251
>
> If other libraries you use also operate on global objects in a thread-
> unsafe way (i.e. they are not using proxy wrappers *and* you cannot
> guarantee that the main queue will not be dispatched in parallel) then
> you will have to patch them.
>
> Regards
> Philipp
>
>
>>
>> [1] https://lists.freedesktop.org/archives/wayland-devel/2017-August/
>> 034784.html
>>
>> [2] https://github.com/GENIVI/wayland-ivi-extension/blob/1.9.1/ivi-la
>> yermanagement-api/ilmControl/src/ilm_control_wayland_platform.c
>> (function: init_control(),  line: 1260 )
>>
>>
>> Thanking you in advance for your time and comments.
>>
>>
>>
>> Thanks & Regards,
>>
>> Vikash
>> ___
>> wayland-devel mailing list
>> wayland-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [wayland + ILM] proxy wrappers usage of wayland 1.11.0 to 1.9.0

2017-08-18 Thread Philipp Kerling
Hi,

Am Freitag, den 18.08.2017, 18:35 +0530 schrieb Vikas Patil:
> Dear All,
> 
> 
> I have backported following patches from wayland 1.11.0 to 1.9.0 to
> test one crash issue [1] . I am able to backport and start Weston
> with
> it. Is this valid thing to do?
> 
> 
> https://cgit.freedesktop.org/wayland/wayland/commit/?id=6d29c0da3cd16
> 8e08187cd204d2314188479c0f1
> [client: Introduce proxy wrappers]
> 
> https://cgit.freedesktop.org/wayland/wayland/commit/?id=6fe12f02e3b48
> 79cd3d5faa08f023cc761d13be9
> [client: Fix wl_display_roundtrip_queue() race condition]
> 
> https://cgit.freedesktop.org/wayland/wayland/commit/?id=69ec70fb0d3f7
> 5f4bcce449238d6297f6a986b5f
> [tests/queue-test: Add tests for proxy wrappers] -- not required.
> 
> 
> 
> Now If I understand it correctly I need to use/modify code where the
> wayland client creates the proxy and sets the queue. One such
> components is [2] ILM control library. I tried to do as per the
> patches but with it nothing is coming on display even though weston
> starts successfully with ivi-shell and ivi-controller.so.
> 
> 
> Attached here the modified file. I would like to understand if the
> way I used is correct or not? Could someone explain this fix and How
> to use it properly for ILM control library? Do I need to add similar
> fix in qtwayland  5.5.1 and other such components (e.g. wayland sink
> from gstreamer) ?
I think there are some problems judging by a quick look at your file:
 * You create a wrapper for the wl_display, but then call
   wl_display_get_registry on your original display. You need to use
   the wrapped display here.
 * Consequently, you must set the queue on the wl_display wrapper
   before that so it correctly gets inherited to the wl_registry.
 * I don't understand what you use wl_display_sync for. You do know
   that wl_display_roundtrip_queue uses that implicitly?
 * You must add the registry listener immediately after creating it and
   not dispatch any events (on the queue the registry uses) in between.
   Otherwise they will get lost.

You might want to take a look at how other libraries use the API, e.g.
https://github.com/01org/libva/blob/master/va/wayland/va_wayland_drm.c#L251

If other libraries you use also operate on global objects in a thread-
unsafe way (i.e. they are not using proxy wrappers *and* you cannot
guarantee that the main queue will not be dispatched in parallel) then
you will have to patch them.

Regards
Philipp


> 
> [1] https://lists.freedesktop.org/archives/wayland-devel/2017-August/
> 034784.html
> 
> [2] https://github.com/GENIVI/wayland-ivi-extension/blob/1.9.1/ivi-la
> yermanagement-api/ilmControl/src/ilm_control_wayland_platform.c
> (function: init_control(),  line: 1260 )
> 
> 
> Thanking you in advance for your time and comments.
> 
> 
> 
> Thanks & Regards,
> 
> Vikash
> ___
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[wayland + ILM] proxy wrappers usage of wayland 1.11.0 to 1.9.0

2017-08-18 Thread Vikas Patil
Dear All,


I have backported following patches from wayland 1.11.0 to 1.9.0 to
test one crash issue [1] . I am able to backport and start Weston with
it. Is this valid thing to do?


https://cgit.freedesktop.org/wayland/wayland/commit/?id=6d29c0da3cd168e08187cd204d2314188479c0f1
[client: Introduce proxy wrappers]

https://cgit.freedesktop.org/wayland/wayland/commit/?id=6fe12f02e3b4879cd3d5faa08f023cc761d13be9
[client: Fix wl_display_roundtrip_queue() race condition]

https://cgit.freedesktop.org/wayland/wayland/commit/?id=69ec70fb0d3f75f4bcce449238d6297f6a986b5f
[tests/queue-test: Add tests for proxy wrappers] -- not required.



Now If I understand it correctly I need to use/modify code where the
wayland client creates the proxy and sets the queue. One such
components is [2] ILM control library. I tried to do as per the
patches but with it nothing is coming on display even though weston
starts successfully with ivi-shell and ivi-controller.so.


Attached here the modified file. I would like to understand if the
way I used is correct or not? Could someone explain this fix and How
to use it properly for ILM control library? Do I need to add similar
fix in qtwayland  5.5.1 and other such components (e.g. wayland sink
from gstreamer) ?


[1] https://lists.freedesktop.org/archives/wayland-devel/2017-August/034784.html

[2] 
https://github.com/GENIVI/wayland-ivi-extension/blob/1.9.1/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c
(function: init_control(),  line: 1260 )


Thanking you in advance for your time and comments.



Thanks & Regards,

Vikash
/**
 *
 * Copyright (C) 2013 DENSO CORPORATION
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 /
#include 
#include 
#include 
#include 
#include 
#include 
#include 

#include 
#include 

#include 

#include "ilm_common.h"
#include "ilm_control_platform.h"
#include "wayland-util.h"
#include "ivi-controller-client-protocol.h"
#include "ivi-input-client-protocol.h"

/* GCC visibility */
#if defined(__GNUC__) && __GNUC__ >= 4
#define ILM_EXPORT __attribute__ ((visibility("default")))
#else
#define ILM_EXPORT
#endif

struct layer_context {
struct wl_list link;

struct ivi_controller_layer *controller;
t_ilm_uint id_layer;

struct ilmLayerProperties prop;
layerNotificationFunc notification;

struct {
struct wl_list list_surface;
struct wl_list link;
} order;

struct wayland_context *ctx;
};

struct screen_context {
struct wl_list link;

struct wl_output *output;
struct ivi_controller_screen *controller;
t_ilm_uint id_from_server;
t_ilm_uint id_screen;
int32_t transform;

struct ilmScreenProperties prop;

struct {
struct wl_list list_layer;
} order;

struct ilm_control_context *ctx;
};

static inline void lock_context(struct ilm_control_context *ctx)
{
   pthread_mutex_lock(>mutex);
}

static inline void unlock_context(struct ilm_control_context *ctx)
{
   pthread_mutex_unlock(>mutex);
}

static int init_control(void);

static struct surface_context* get_surface_context(struct wayland_context *, uint32_t);

void release_instance(void);

static int create_controller_layer(struct wayland_context *ctx, t_ilm_uint width, t_ilm_uint height, t_ilm_layer layerid);

static int32_t
wayland_controller_is_inside_layer_list(struct wl_list *list,
uint32_t id_layer)
{
struct layer_context *ctx_layer = NULL;
wl_list_for_each(ctx_layer, list, link) {
if (ctx_layer->id_layer == id_layer) {
return 1;
}
}

return 0;
}

static struct layer_context*
wayland_controller_get_layer_context(struct wayland_context *ctx,
 uint32_t id_layer)
{
struct layer_context *ctx_layer = NULL;

if (ctx->controller == NULL) {
fprintf(stderr, "controller is not initialized in ilmControl\n");
return NULL;
}

wl_list_for_each(ctx_layer, >list_layer, link) {
if (ctx_layer->id_layer == id_layer) {
return ctx_layer;
}
}

return NULL;
}

static void
output_listener_geometry(void *data,
 struct wl_output *output,
 int32_t x,
 int32_t y,
 int32_t physical_width,