QNX Message Passing to control events

We are using QNX message passing from computer “A” to drive events on the
screen of computer “B”

In principle, Computer B is in a wait state until it receives the first
message from computer “A” and then depending upon the message draws a
different image on the screen. All of the draw functions work (both
before messages are received, and during the message passing routines,
however one image that renders instanteously before the message loop is
initiated (initiated by computer “A’s” first message) takes literally
seconds to render if called by a message.

The code for the image in question is

/*

  • prob will be probability that each dot is shown
  • 10 => pitch black, 1 => very white
    /
    void draw_square(int prob)
    {
    /
    might be cleaner w/o widgets, but docs discourage this.
  • i break up drawing the random dots into 64 element rows
  • because the pixel widget has a limit on the number of
  • elements it will draw at once.
    */

PtWidget_t* pixel;
PtArg_t args[3];
PhPoint_t points[SQUARE_LENGTH * SQUARE_LENGTH];
PhPoint_t origin = { SQUARE_ORIGIN_X, SQUARE_ORIGIN_Y};
int i, j, row;

/* note: this will always set upper left pixel */
memset(&points, 0, 64 * 64 * sizeof(PhPoint_t));

for (i = 0; i < SQUARE_LENGTH; i++) {
for (j = 0; j < SQUARE_LENGTH; j++) {
if( !((rand() % 10) < prob)) {
points[i + j * SQUARE_LENGTH].x = i;
points[i + j * SQUARE_LENGTH].y = j;
}
}
}

PtSetArg(&args[0], Pt_ARG_ORIGIN, &origin, 0);
PtSetArg(&args[1], Pt_ARG_COLOR, Pg_WHITE, 0);

for (row = 0; row < 64; row++) {
PtSetArg(&args[2], Pt_ARG_POINTS, &points[SQUARE_LENGTH *
row], 64);
pixel = PtCreateWidget(PtPixel, NULL, 3, args);
PtRealizeWidget(pixel);
}
}


The image is a 64 X 64 pixel array. It is designed to alter the intensity
drawn depending upon the input given, for example, if given an inout of 1,
then 10% of the dots should be black, if 9 then 90% should be black. This
code works fine, the only poblem is the image is rendered in seconds
(literally) if done during the message passing loop, but rendered
instantaeously if done by itself (ie before message passing begins.

Any thoughts on this would be greatly appreciated.

Sincerely

Anil Cherian

Just wondering if anyone had any hints or suggestions to offer on this
problems

Thanks in advance

Anil Cherian
a-cherian@northwestern.edu

i’m not sure if i follow you on this… what does the the message
pseudo code look like?
are you passing the 64x64 pixel array as message data and then parsing it
on the other side?

note that photon114 is single threaded, so if your photon app blocks on
someone else then all of your photon event processing will block.

a typical way around this is to have a worker process on the same machine
get given data either via a local message pass or thru shared memory
buffers etc…
then your local photon app keeps updating while a copy of the data is now
handled by the worker process who does the message over the net for you.

a-cherian@northwestern.edu wrote:

We are using QNX message passing from computer “A” to drive events on the
screen of computer “B”

In principle, Computer B is in a wait state until it receives the first
message from computer “A” and then depending upon the message draws a
different image on the screen. All of the draw functions work (both
before messages are received, and during the message passing routines,
however one image that renders instanteously before the message loop is
initiated (initiated by computer “A’s” first message) takes literally
seconds to render if called by a message.

The code for the image in question is

/*

  • prob will be probability that each dot is shown
  • 10 => pitch black, 1 => very white
    /
    void draw_square(int prob)
    {
    /
    might be cleaner w/o widgets, but docs discourage this.
  • i break up drawing the random dots into 64 element rows
  • because the pixel widget has a limit on the number of
  • elements it will draw at once.
    */

PtWidget_t* pixel;
PtArg_t args[3];
PhPoint_t points[SQUARE_LENGTH * SQUARE_LENGTH];
PhPoint_t origin = { SQUARE_ORIGIN_X, SQUARE_ORIGIN_Y};
int i, j, row;

/* note: this will always set upper left pixel */
memset(&points, 0, 64 * 64 * sizeof(PhPoint_t));

for (i = 0; i < SQUARE_LENGTH; i++) {
for (j = 0; j < SQUARE_LENGTH; j++) {
if( !((rand() % 10) < prob)) {
points[i + j * SQUARE_LENGTH].x = i;
points[i + j * SQUARE_LENGTH].y = j;
}
}
}

PtSetArg(&args[0], Pt_ARG_ORIGIN, &origin, 0);
PtSetArg(&args[1], Pt_ARG_COLOR, Pg_WHITE, 0);

for (row = 0; row < 64; row++) {
PtSetArg(&args[2], Pt_ARG_POINTS, &points[SQUARE_LENGTH *
row], 64);
pixel = PtCreateWidget(PtPixel, NULL, 3, args);
PtRealizeWidget(pixel);
}
}



The image is a 64 X 64 pixel array. It is designed to alter the intensity
drawn depending upon the input given, for example, if given an inout of 1,
then 10% of the dots should be black, if 9 then 90% should be black. This
code works fine, the only poblem is the image is rendered in seconds
(literally) if done during the message passing loop, but rendered
instantaeously if done by itself (ie before message passing begins.

Any thoughts on this would be greatly appreciated.

Sincerely

Anil Cherian


Randy Martin randy@qnx.com
Manager of FAE Group, North America
QNX Software Systems www.qnx.com
175 Terence Matthews Crescent, Kanata, Ontario, Canada K2M 1W8
Tel: 613-591-0931 Fax: 613-591-3579

The message sent from computer A is an integer. For example, it will send
an integer of -1 to display a red dot in the middle of the screen (which
starts the program for the user) and then will send a series of other
positive integers from 1 to 9. When these positive integers are received
by computer B, they are then inputed to the draw code below (int prob),
which uses the integer as a percentage level (ie 1 = 10% and 9 = 90) ( i
hope I have explained this well enough, if not please let me know.)+. I
dont think this is a message passing problem, but if so, how would I set
up this “worker process”


If I wanted to take the draw code below and draw within shared memory, how
would i do so? I have looked at the docs, but cant figure out how to set
it up in the PtDBContainer, or within shared memory commands.

Thanks in advance for your help

Anil



i’m not sure if i follow you on this… what does the the message
pseudo code look like?
are you passing the 64x64 pixel array as message data and then parsing it
on the other side?

note that photon114 is single threaded, so if your photon app blocks on
someone else then all of your photon event processing will block.

a typical way around this is to have a worker process on the same machine
get given data either via a local message pass or thru shared memory
buffers etc…
then your local photon app keeps updating while a copy of the data is now
handled by the worker process who does the message over the net for you.

a-cherian@northwestern.edu wrote:

We are using QNX message passing from computer “A” to drive events on
the
screen of computer “B”

In principle, Computer B is in a wait state until it receives the first
message from computer “A” and then depending upon the message draws a
different image on the screen. All of the draw functions work (both
before messages are received, and during the message passing routines,
however one image that renders instanteously before the message loop is
initiated (initiated by computer “A’s” first message) takes literally
seconds to render if called by a message.

The code for the image in question is

/*

  • prob will be probability that each dot is shown
  • 10 => pitch black, 1 => very white
    /
    void draw_square(int prob)
    {
    /
    might be cleaner w/o widgets, but docs discourage this.
  • i break up drawing the random dots into 64 element rows
  • because the pixel widget has a limit on the number of
  • elements it will draw at once.
    */

PtWidget_t* pixel;
PtArg_t args[3];
PhPoint_t points[SQUARE_LENGTH * SQUARE_LENGTH];
PhPoint_t origin = { SQUARE_ORIGIN_X, SQUARE_ORIGIN_Y};
int i, j, row;

/* note: this will always set upper left pixel */
memset(&points, 0, 64 * 64 * sizeof(PhPoint_t));

for (i = 0; i < SQUARE_LENGTH; i++) {
for (j = 0; j < SQUARE_LENGTH; j++) {
if( !((rand() % 10) < prob)) {
points[i + j * SQUARE_LENGTH].x = i;
points[i + j * SQUARE_LENGTH].y = j;
}
}
}

PtSetArg(&args[0], Pt_ARG_ORIGIN, &origin, 0);
PtSetArg(&args[1], Pt_ARG_COLOR, Pg_WHITE, 0);

for (row = 0; row < 64; row++) {
PtSetArg(&args[2], Pt_ARG_POINTS, &points[SQUARE_LENGTH
*
row], 64);
pixel = PtCreateWidget(PtPixel, NULL, 3, args);
PtRealizeWidget(pixel);
}
}



The image is a 64 X 64 pixel array. It is designed to alter the
intensity
drawn depending upon the input given, for example, if given an inout of
1,
then 10% of the dots should be black, if 9 then 90% should be black.
This
code works fine, the only poblem is the image is rendered in seconds
(literally) if done during the message passing loop, but rendered
instantaeously if done by itself (ie before message passing begins.

Any thoughts on this would be greatly appreciated.

Sincerely

Anil Cherian


Randy Martin randy@qnx.com
Manager of FAE Group, North America
QNX Software Systems www.qnx.com
175 Terence Matthews Crescent, Kanata, Ontario, Canada K2M 1W8
Tel: 613-591-0931 Fax: 613-591-3579

Just wionderiing if anyone had any thoughts about this, the last time I
heard from someone was May 25.

Please help!

Thanks


Anil
a-cherian@northwestern.edu