PdCreateVideoChannel/PgConfigScalerChannel/mem_offset proble

I am having a problem with the following code returning a failure.

It works FINE on a Geode/MediaGX based platform but fails
quite nastily on a different ATI development platform.

What I am doing is trying to get a PHYSICAL address pointer
to the actual memory location of the scaler region created by
Photon. I can access the virtual pointer and bash data to it quite
successfully. But I need the physical memory address so that
a secondary processor (PCI bus master) can directly shove video
data into the YUV video buffer.

The problem is that although I get back a “valid” PdGetOffScreenContextPtr,
when I pass it to either mem_offset or posix_mem_offset, they both return
with a “-1” and errno of “7”.

On the MediaGX box this code works PERFECTLY.
On two different ATI video based boxes the last statement (mem_offset)
fails…

Any ideas???

The code is (basically) as follows:


if ((channel = PgCreateVideoChannel(Pg_VIDEO_CHANNEL_SCALER, 0)) == NULL)
exit (-1);

i = 0;
vcaps.size = sizeof (vcaps);
while (PgGetScalerCapabilities(channel, i++, &vcaps) == 0)
{
if (vcaps.format == Pg_VIDEO_FORMAT_UYVY)
break;
vcaps.size = sizeof (vcaps);
}

if (vcaps.format == -1)
exit(-1);

props.size = sizeof (props);
props.format = vcaps.format;
props.viewport.ul.x = 0;
props.viewport.ul.y = 0;
props.viewport.lr.x = props.viewport.ul.x + 640;
props.viewport.lr.y = props.viewport.ul.y + 480;
props.src_dim.w = 640;
props.src_dim.h = 480;
props.brightness = 0;
props.contrast = 0;
props.flags =
Pg_SCALER_PROP_SCALER_ENABLE | Pg_SCALER_PROP_DISABLE_FILTERING |
Pg_SCALER_PROP_CHROMA_ENABLE;
props.color_key = PgRGB(240,0,240);

if (PgConfigScalerChannel(channel, &props) == -1)
exit(-1);

ybuf0 = PdGetOffscreenContextPtr(channel->yplane1);
err = mem_offset( ybuf0, NOFD, 1, &physical_address, NULL );

etc…


For reference, the mem_offset part of this code was
suggested by Gibbs/Donahoe anyway…and brings up a
question I had back in July of 2K on whether mem_offset or
posix_mem_offset was going to be the standard for RTP…

From a MUCH earlier post from Gibbs…

mem_offset( ptr, NOFD, 1, &physical_address, NULL );
this works nicely as well (basically like the virt_to_bus function
Dave built into his port of ALSA). However, I noticed that
mem_offset/mem_offset64 are supposed to be going away in
the next release (according to the HelpViewer [and Dave]).

I think this has been reversed – my understanding is that they
WERE supposed to be replaced by posix_mem_offset(), but that
posix_mem_offset() got dropped from draft 10 (or changed so
radically that it couldn’t be used for this), so mem_offset()
is the way to go.

So which is it? mem_offset or posix_mem_offset?
And why does neither work when used in this manner with
the Rage drivers under Photon?

Any help or answers would be greatly appreciated…I’m basically dead in the
water at this point!

Hi Michael,

I have spoken to the developers and one suggestion is to try using mem_offset64.
The thought is that mem_offset returns the address via a
pointer to an off_t, since an off_t is signed, and physical addresses are not. This could be the cause of the problem.

On the media GX, it would work, because the physical memory address is
below 0x80000000.

I hope this works for you.
Thanks
Brenda


Previously, Michael D. Burkey wrote in qdn.public.qnxrtp.photon:

I am having a problem with the following code returning a failure.

It works FINE on a Geode/MediaGX based platform but fails
quite nastily on a different ATI development platform.

What I am doing is trying to get a PHYSICAL address pointer
to the actual memory location of the scaler region created by
Photon. I can access the virtual pointer and bash data to it quite
successfully. But I need the physical memory address so that
a secondary processor (PCI bus master) can directly shove video
data into the YUV video buffer.

The problem is that although I get back a “valid” PdGetOffScreenContextPtr,
when I pass it to either mem_offset or posix_mem_offset, they both return
with a “-1” and errno of “7”.

On the MediaGX box this code works PERFECTLY.
On two different ATI video based boxes the last statement (mem_offset)
fails…

Any ideas???

The code is (basically) as follows:


if ((channel = PgCreateVideoChannel(Pg_VIDEO_CHANNEL_SCALER, 0)) == NULL)
exit (-1);

i = 0;
vcaps.size = sizeof (vcaps);
while (PgGetScalerCapabilities(channel, i++, &vcaps) == 0)
{
if (vcaps.format == Pg_VIDEO_FORMAT_UYVY)
break;
vcaps.size = sizeof (vcaps);
}

if (vcaps.format == -1)
exit(-1);

props.size = sizeof (props);
props.format = vcaps.format;
props.viewport.ul.x = 0;
props.viewport.ul.y = 0;
props.viewport.lr.x = props.viewport.ul.x + 640;
props.viewport.lr.y = props.viewport.ul.y + 480;
props.src_dim.w = 640;
props.src_dim.h = 480;
props.brightness = 0;
props.contrast = 0;
props.flags =
Pg_SCALER_PROP_SCALER_ENABLE | Pg_SCALER_PROP_DISABLE_FILTERING |
Pg_SCALER_PROP_CHROMA_ENABLE;
props.color_key = PgRGB(240,0,240);

if (PgConfigScalerChannel(channel, &props) == -1)
exit(-1);

ybuf0 = PdGetOffscreenContextPtr(channel->yplane1);
err = mem_offset( ybuf0, NOFD, 1, &physical_address, NULL );

etc…


For reference, the mem_offset part of this code was
suggested by Gibbs/Donahoe anyway…and brings up a
question I had back in July of 2K on whether mem_offset or
posix_mem_offset was going to be the standard for RTP…

From a MUCH earlier post from Gibbs…
mem_offset( ptr, NOFD, 1, &physical_address, NULL );
this works nicely as well (basically like the virt_to_bus function
Dave built into his port of ALSA). However, I noticed that
mem_offset/mem_offset64 are supposed to be going away in
the next release (according to the HelpViewer [and Dave]).

I think this has been reversed – my understanding is that they
WERE supposed to be replaced by posix_mem_offset(), but that
posix_mem_offset() got dropped from draft 10 (or changed so
radically that it couldn’t be used for this), so mem_offset()
is the way to go.

So which is it? mem_offset or posix_mem_offset?
And why does neither work when used in this manner with
the Rage drivers under Photon?

Any help or answers would be greatly appreciated…I’m basically dead in the
water at this point!
\

Hi Michael,

I checked with the developer on which one we are going towards and
he believes the plan is to use mem_offset64.

Hope this helps
Thanks
Brenda

Previously, Michael D. Burkey wrote in qdn.public.qnxrtp.photon:

Thats was the problem. I changed it to mem_offset64 and
everything works quite nicely.

Thanks!

There was the one other question I had:
Is mem_offset64 or posix_mem_offset64 the way to plan
for future code?

Back in July there was still some discussion
as to which was going to be the “official” standard for RTP
– even though the documentation had already been updated
to say that mem_offset64 was deprecated and to start using
posix_mem_offset64.

“Brenda Merpaw” <> gui@qnx.com> > wrote in message
news:Voyager.010503145023.7598111A@bmerpaw…
Hi Michael,

I have spoken to the developers and one suggestion is to try using
mem_offset64.
The thought is that mem_offset returns the address via a
pointer to an off_t, since an off_t is signed, and physical addresses are
not. This could be the cause of the problem.

On the media GX, it would work, because the physical memory address is
below 0x80000000.

I hope this works for you.
Thanks
Brenda


Previously, Michael D. Burkey wrote in qdn.public.qnxrtp.photon:
I am having a problem with the following code returning a failure.

It works FINE on a Geode/MediaGX based platform but fails
quite nastily on a different ATI development platform.

What I am doing is trying to get a PHYSICAL address pointer
to the actual memory location of the scaler region created by
Photon. I can access the virtual pointer and bash data to it quite
successfully. But I need the physical memory address so that
a secondary processor (PCI bus master) can directly shove video
data into the YUV video buffer.

The problem is that although I get back a “valid”
PdGetOffScreenContextPtr,
when I pass it to either mem_offset or posix_mem_offset, they both
return
with a “-1” and errno of “7”.

On the MediaGX box this code works PERFECTLY.
On two different ATI video based boxes the last statement (mem_offset)
fails…

Any ideas???

The code is (basically) as follows:


if ((channel = PgCreateVideoChannel(Pg_VIDEO_CHANNEL_SCALER, 0)) ==
NULL)
exit (-1);

i = 0;
vcaps.size = sizeof (vcaps);
while (PgGetScalerCapabilities(channel, i++, &vcaps) == 0)
{
if (vcaps.format == Pg_VIDEO_FORMAT_UYVY)
break;
vcaps.size = sizeof (vcaps);
}

if (vcaps.format == -1)
exit(-1);

props.size = sizeof (props);
props.format = vcaps.format;
props.viewport.ul.x = 0;
props.viewport.ul.y = 0;
props.viewport.lr.x = props.viewport.ul.x + 640;
props.viewport.lr.y = props.viewport.ul.y + 480;
props.src_dim.w = 640;
props.src_dim.h = 480;
props.brightness = 0;
props.contrast = 0;
props.flags =
Pg_SCALER_PROP_SCALER_ENABLE | Pg_SCALER_PROP_DISABLE_FILTERING |
Pg_SCALER_PROP_CHROMA_ENABLE;
props.color_key = PgRGB(240,0,240);

if (PgConfigScalerChannel(channel, &props) == -1)
exit(-1);

ybuf0 = PdGetOffscreenContextPtr(channel->yplane1);
err = mem_offset( ybuf0, NOFD, 1, &physical_address, NULL );

etc…


For reference, the mem_offset part of this code was
suggested by Gibbs/Donahoe anyway…and brings up a
question I had back in July of 2K on whether mem_offset or
posix_mem_offset was going to be the standard for RTP…

From a MUCH earlier post from Gibbs…
mem_offset( ptr, NOFD, 1, &physical_address, NULL );
this works nicely as well (basically like the virt_to_bus function
Dave built into his port of ALSA). However, I noticed that
mem_offset/mem_offset64 are supposed to be going away in
the next release (according to the HelpViewer [and Dave]).

I think this has been reversed – my understanding is that they
WERE supposed to be replaced by posix_mem_offset(), but that
posix_mem_offset() got dropped from draft 10 (or changed so
radically that it couldn’t be used for this), so mem_offset()
is the way to go.

So which is it? mem_offset or posix_mem_offset?
And why does neither work when used in this manner with
the Rage drivers under Photon?

Any help or answers would be greatly appreciated…I’m basically dead in
the
water at this point!




\

Thats was the problem. I changed it to mem_offset64 and
everything works quite nicely.

Thanks!

There was the one other question I had:
Is mem_offset64 or posix_mem_offset64 the way to plan
for future code?

Back in July there was still some discussion
as to which was going to be the “official” standard for RTP
– even though the documentation had already been updated
to say that mem_offset64 was deprecated and to start using
posix_mem_offset64.

“Brenda Merpaw” <gui@qnx.com> wrote in message
news:Voyager.010503145023.7598111A@bmerpaw…

Hi Michael,

I have spoken to the developers and one suggestion is to try using
mem_offset64.
The thought is that mem_offset returns the address via a
pointer to an off_t, since an off_t is signed, and physical addresses are
not. This could be the cause of the problem.

On the media GX, it would work, because the physical memory address is
below 0x80000000.

I hope this works for you.
Thanks
Brenda


Previously, Michael D. Burkey wrote in qdn.public.qnxrtp.photon:
I am having a problem with the following code returning a failure.

It works FINE on a Geode/MediaGX based platform but fails
quite nastily on a different ATI development platform.

What I am doing is trying to get a PHYSICAL address pointer
to the actual memory location of the scaler region created by
Photon. I can access the virtual pointer and bash data to it quite
successfully. But I need the physical memory address so that
a secondary processor (PCI bus master) can directly shove video
data into the YUV video buffer.

The problem is that although I get back a “valid”
PdGetOffScreenContextPtr,
when I pass it to either mem_offset or posix_mem_offset, they both
return
with a “-1” and errno of “7”.

On the MediaGX box this code works PERFECTLY.
On two different ATI video based boxes the last statement (mem_offset)
fails…

Any ideas???

The code is (basically) as follows:


if ((channel = PgCreateVideoChannel(Pg_VIDEO_CHANNEL_SCALER, 0)) ==
NULL)
exit (-1);

i = 0;
vcaps.size = sizeof (vcaps);
while (PgGetScalerCapabilities(channel, i++, &vcaps) == 0)
{
if (vcaps.format == Pg_VIDEO_FORMAT_UYVY)
break;
vcaps.size = sizeof (vcaps);
}

if (vcaps.format == -1)
exit(-1);

props.size = sizeof (props);
props.format = vcaps.format;
props.viewport.ul.x = 0;
props.viewport.ul.y = 0;
props.viewport.lr.x = props.viewport.ul.x + 640;
props.viewport.lr.y = props.viewport.ul.y + 480;
props.src_dim.w = 640;
props.src_dim.h = 480;
props.brightness = 0;
props.contrast = 0;
props.flags =
Pg_SCALER_PROP_SCALER_ENABLE | Pg_SCALER_PROP_DISABLE_FILTERING |
Pg_SCALER_PROP_CHROMA_ENABLE;
props.color_key = PgRGB(240,0,240);

if (PgConfigScalerChannel(channel, &props) == -1)
exit(-1);

ybuf0 = PdGetOffscreenContextPtr(channel->yplane1);
err = mem_offset( ybuf0, NOFD, 1, &physical_address, NULL );

etc…


For reference, the mem_offset part of this code was
suggested by Gibbs/Donahoe anyway…and brings up a
question I had back in July of 2K on whether mem_offset or
posix_mem_offset was going to be the standard for RTP…

From a MUCH earlier post from Gibbs…
mem_offset( ptr, NOFD, 1, &physical_address, NULL );
this works nicely as well (basically like the virt_to_bus function
Dave built into his port of ALSA). However, I noticed that
mem_offset/mem_offset64 are supposed to be going away in
the next release (according to the HelpViewer [and Dave]).

I think this has been reversed – my understanding is that they
WERE supposed to be replaced by posix_mem_offset(), but that
posix_mem_offset() got dropped from draft 10 (or changed so
radically that it couldn’t be used for this), so mem_offset()
is the way to go.

So which is it? mem_offset or posix_mem_offset?
And why does neither work when used in this manner with
the Rage drivers under Photon?

Any help or answers would be greatly appreciated…I’m basically dead in
the
water at this point!

\