DVB-S2 multistream support

Message ID CAF0Ff2=nfGA_jWc4tLnun792C1PN0rZHkGhY=uJz8YHCsFnvKA@mail.gmail.com (mailing list archive)
State Not Applicable, archived
Headers

Commit Message

Konstantin Dimitrov March 19, 2012, 3:19 p.m. UTC
  hello Christian,

first of all thank you for the great work. so, i have few follow-ups about it:

1. since your current patch contains patches that are kernel-specific
changes (i.e. some general changes to the V4L code for the kernel you
use), changes related to the BBFrame-support and hardware-specific
changes (i.e. related to the TBS 6925 card, which at the moment is the
only affordable hardware at least i know that can handle BBFrames) in
order for more easy use in different kernels as well for the purpose
of others to review the changes related to the BBFrame-support in V4L
'dvb-core' i split your patch to 3 separate patches (they are attached
to this email):

- 01-bb-dmx.patch : it's supposed to contains all changes you made to
the demux part of V4L 'dvb-core' - i didn't make any further changes -
just collected your original changes in the patch; it should apply
clean to all recent kernel released in the last several months (i
believe at least in the last 6 months), because no changes in this
parts of 'dvb-core' were made recently

- 02-bb-fe.patch : those are changes for BBFrame-support related to
the frontend - i separated those changes and i didn't include them in
'01-bb-dmx.patch', because recently a lot of changes were made to that
part of V4L. so, this patch will apply clean to
"tbs-linux-drivers_v120206" and to other V4L trees most probably it
will require to manually apply the changes to the respective files,
but since it changes less than 10 lines in only 3 files that's just
fine for manual patching

- 03-bb-tbs.patch : those are all changes specific to the TBS 6925
hardware. additionally to your changes i defined "tsout" module
parameter to both 'stv090x' and 'saa716x_tbs-dvb' - that's convenient
to change between TS and BB mode just with reloading the modules with
rmmod/modprobe

2. so i used the above 3 patches with "tbs-linux-drivers_v120206" and
after i applied them:

# cd linux-tbs-drivers
# patch -p1 < ../01-bb-dmx.patch
# patch -p1 < ../02-bb-fe.patch
# patch -p1 < ../03-bb-tbs.patch

the driver builds successfully, but i'm not sure if i didn't miss
something from your original patch. also, i put file called
'tbs6925.conf' in /etc/modprobe.d with lines in it:

options stv090x tsout=0
options saa716x_tbs-dvb tsout=0

for easy enable/disable of the BB mode with just reloading the modules
in order to make the testing easier.

3. so on the test i did every few seconds i get the following errors:

_dvb_dmx_swfilter_bbframe: invalid use of reserved TS/GS value 1

_dvb_dmx_swfilter_bbframe: invalid data field length (length 0, left 10)

and hex-dump of the BBFrame data. is that supposed to happen? please,
can you confirm if it happens or not in your environment with your
original patch or i messed-up something when i prepared the 3 patches
from point 1. so, that request is in relation to my seconds request -
please, review the 3 patches from point 1 and confirm they are correct
and i didn't miss anything - if they are correct patch 01 and 02 can
be used for review of the code.

many thanks,
konstantin

On Mon, Mar 19, 2012 at 10:46 AM, Christian Prähauser
<cpraehaus@cosy.sbg.ac.at> wrote:
> Dear all,
>
> I decided to post a patch against the TBS drivers for all those who want to
> experiment
> with the very preliminary base-band demultiplexer until I have a repository
> to properly host
> this stuff. Currently it only works for the
> TBS 6925 card. The bb-dmx was created for Linux v3.3, so the patch also
> contains some
> changes that made it into Linux since TBS driver release v111118. You can
> get the TBS source
> code via this direct link (I know there's a newer version but the patch is
> against the old driver package):
>
> http://www.tbsdtv.com/download/document/common/tbs-linux-drivers_v111118.zip
>
> And then you can download the bb-dmx patch from here:
>
> http://www.cosy.sbg.ac.at/~cpraehaus/download/tbs_v111118_bb-dmx_2012-03-19.patch.gz
>
>
> Tuning and configuration of the card is as normal, notice however that the
> card is currently
> put in base-band data mode irrespective of any configuration. This means
> that you probably wont
> be able to receive DVB-S.
>
> To test the bb-dmx support, there is a patch against dvbsnoop 1.4.5. You can
> get the source from the SF site:
>
> http://dvbsnoop.sourceforge.net/
>
> and the patch from here:
>
> http://www.cosy.sbg.ac.at/~cpraehaus/download/dvbsnoop-1.4.50_bb-dmx_2012-03-19.patch
>
> Usage:
> dvbsnoop -s bb <ISI>    (receive bbframes from <ISI>)
>
> dvbsnoop -s bb -tsraw   (receive everything)
>
>
> Sorry, its still all very experimental and DVB-S2 specific, but I'd be happy
> to get feedback from those interested.
>
> Thanks and kind regards,
> Christian.
>
>
> Am 15.03.2012 um 10:40 schrieb Christian Prähauser:
>
>
>> Dear all,
>>
>> First, thanks for your interest in this functionality. I think the
>> modifications
>> are in a shape where they begin to be useful for others. Currently
>> I'm (still) trying to get some GIT repo where I can host the whole stuff.
>>
>> Thank you all for your support, testing will indeed by important after the
>> first
>> version is "in the wild" :-). I definitely want to keep this going and be
>> sure
>> that I tell you as soon as the code can be accessed.
>>
>> Kind regards,
>> Christian.
>>
>> Am 13.03.2012 um 16:47 schrieb Bob W:
>>
>>>
>>>
>>> Hi Konstantin,
>>>
>>>
>>>> all work to support BBFrames in the Linux kernel is done by Christian
>>>> - in fact it's a long lost work from 5 years ago:
>>>>
>>>> http://www.linuxtv.org/pipermail/linux-dvb/2007-December/022217.html
>>>
>>>
>>> yep, I have followed the history back...  and like Christian said, the
>>> old repo is nolonger working.  :(
>>>
>>>>
>>>> and i hope it won't be lost again. i just encouraged Christian that
>>>> his work is important and there are people interested in it - you're
>>>> one such example. so, i offered Christian to help him with i can. i
>>>> guess more people appreciating what his doing and encourage him will
>>>> give him better motivation to release the code to the public. however,
>>>> i guess the delay is more, because it's not easy and it requires time
>>>> to prepare the code for initial public release and that's why the
>>>> delay. so, i don't have Christian's code and i'm eager as you're to be
>>>> able to try it out, but we need to be patient. i'm sure that after
>>>> there is some public release and repository more people will be
>>>> interested to contribute to that work.
>>>>
>>>> best regards,
>>>> konstantin
>>>
>>>
>>>
>>> Agreed, I understand the pressure of releasing publicly.  Once released,
>>> the nit picking begins.. lol.   I will keep watch on the list.
>>> Christian, if you want an extra tester to help yah, count me in.  I'll
>>> help also with what I can.
>>>
>>> Bob
>>>
>>>
>>>
>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-media" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>>
>> ---
>> Dipl.-Ing. Christian Praehauser <cpraehaus@cosy.sbg.ac.at>
>>
>> || //\\//\\ || Multimedia Communications Group,
>> ||//  \/  \\|| Department of Computer Sciences, University of Salzburg
>> http://www.cosy.sbg.ac.at/~cpraehaus/
>> http://www.network-research.org/
>> http://www.uni-salzburg.at/
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-media" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>
> ---
> Dipl.-Ing. Christian Praehauser <cpraehaus@cosy.sbg.ac.at>
>
> || //\\//\\ || Multimedia Communications Group,
> ||//  \/  \\|| Department of Computer Sciences, University of Salzburg
> http://www.cosy.sbg.ac.at/~cpraehaus/
> http://www.network-research.org/
> http://www.uni-salzburg.at/
  

Comments

Bob W April 24, 2012, 10:18 p.m. UTC | #1
Hi all,

  in playing with these patches, I am noticing the bbframes are only
partially being delivered by the hardware.  I am only getting the first
188 bytes of the frame.

I think it is related to the programming of the saa716xx.

In this function:  saa716x_dma_start the params stuct is filled out,
with 188 in the samples and pitch elements..

does anyone know a little more about this saa716x and how to program
it correctly to receive more data to account for the big bbframes?

thanks

Bob




On 3/19/2012 10:19 AM, Konstantin Dimitrov wrote:
> hello Christian,
> 
> first of all thank you for the great work. so, i have few follow-ups about it:
> 
> 1. since your current patch contains patches that are kernel-specific
> changes (i.e. some general changes to the V4L code for the kernel you
> use), changes related to the BBFrame-support and hardware-specific
> changes (i.e. related to the TBS 6925 card, which at the moment is the
> only affordable hardware at least i know that can handle BBFrames) in
> order for more easy use in different kernels as well for the purpose
> of others to review the changes related to the BBFrame-support in V4L
> 'dvb-core' i split your patch to 3 separate patches (they are attached
> to this email):
> 
> - 01-bb-dmx.patch : it's supposed to contains all changes you made to
> the demux part of V4L 'dvb-core' - i didn't make any further changes -
> just collected your original changes in the patch; it should apply
> clean to all recent kernel released in the last several months (i
> believe at least in the last 6 months), because no changes in this
> parts of 'dvb-core' were made recently
> 
> - 02-bb-fe.patch : those are changes for BBFrame-support related to
> the frontend - i separated those changes and i didn't include them in
> '01-bb-dmx.patch', because recently a lot of changes were made to that
> part of V4L. so, this patch will apply clean to
> "tbs-linux-drivers_v120206" and to other V4L trees most probably it
> will require to manually apply the changes to the respective files,
> but since it changes less than 10 lines in only 3 files that's just
> fine for manual patching
> 
> - 03-bb-tbs.patch : those are all changes specific to the TBS 6925
> hardware. additionally to your changes i defined "tsout" module
> parameter to both 'stv090x' and 'saa716x_tbs-dvb' - that's convenient
> to change between TS and BB mode just with reloading the modules with
> rmmod/modprobe
> 
> 2. so i used the above 3 patches with "tbs-linux-drivers_v120206" and
> after i applied them:
> 
> # cd linux-tbs-drivers
> # patch -p1 < ../01-bb-dmx.patch
> # patch -p1 < ../02-bb-fe.patch
> # patch -p1 < ../03-bb-tbs.patch
> 
> the driver builds successfully, but i'm not sure if i didn't miss
> something from your original patch. also, i put file called
> 'tbs6925.conf' in /etc/modprobe.d with lines in it:
> 
> options stv090x tsout=0
> options saa716x_tbs-dvb tsout=0
> 
> for easy enable/disable of the BB mode with just reloading the modules
> in order to make the testing easier.
> 
> 3. so on the test i did every few seconds i get the following errors:
> 
> _dvb_dmx_swfilter_bbframe: invalid use of reserved TS/GS value 1
> 
> _dvb_dmx_swfilter_bbframe: invalid data field length (length 0, left 10)
> 
> and hex-dump of the BBFrame data. is that supposed to happen? please,
> can you confirm if it happens or not in your environment with your
> original patch or i messed-up something when i prepared the 3 patches
> from point 1. so, that request is in relation to my seconds request -
> please, review the 3 patches from point 1 and confirm they are correct
> and i didn't miss anything - if they are correct patch 01 and 02 can
> be used for review of the code.
> 
> many thanks,
> konstantin
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  

Patch

--- a/linux/drivers/media/common/saa716x/saa716x_tbs.c	2012-02-06 15:05:41.000000000 +0200
+++ b/linux/drivers/media/common/saa716x/saa716x_tbs.c	2012-03-19 16:34:35.344928347 +0200
@@ -76,6 +76,10 @@ 
 module_param(ci_mode, int, 0644);
 MODULE_PARM_DESC(ci_mode, "for internal use only: default 0");
 
+static int tsout = 1;
+module_param(tsout, int, 0644);
+MODULE_PARM_DESC(tsout, "TBS 6925 output format 1=TS, 0=BB (default:1)");
+
 #define DRIVER_NAME "SAA716x TBS"
 
 static int __devinit saa716x_tbs_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
@@ -356,7 +360,11 @@ 
 				u8 * data = (u8 *)saa716x->fgpi[3].dma_buf[activeBuffer].mem_virt;
 				dprintk(SAA716x_DEBUG, 1, "%02X%02X%02X%02X",
 					data[0], data[1], data[2], data[3]);
-				dvb_dmx_swfilter_packets(&saa716x->saa716x_adap[0].demux, data, 348);
+				if (tsout == 0)
+					dvb_dmx_swfilter_data(&saa716x->saa716x_adap[0].demux, 
+									FE_DFMT_BB_FRAME, data, 348*188);
+				else
+					dvb_dmx_swfilter_packets(&saa716x->saa716x_adap[0].demux, data, 348);
 			}
 			if (fgpiStatus) {
 				SAA716x_EPWR(FGPI3, INT_CLR_STATUS, fgpiStatus);
--- a/linux/drivers/media/dvb/frontends/stv090x.c	2011-10-09 23:15:32.000000000 +0300
+++ b/linux/drivers/media/dvb/frontends/stv090x.c	2012-03-19 18:00:03.690919513 +0200
@@ -38,6 +38,10 @@ 
 static unsigned int verbose;
 module_param(verbose, int, 0644);
 
+static int tsout = 1;
+module_param(tsout, int, 0644);
+MODULE_PARM_DESC(tsout, "Output data 1=TS, 0=BB (default:1)");
+
 /* internal params node */
 struct stv090x_dev {
 	/* pointer for internal params, one for each pair of demods */
@@ -3166,6 +3170,40 @@ 
 	return -1;
 }
 
+/* Set data output format of Transport Stream Merger.
+ * This function configures the packet delineator and the stream merger units
+ * of the STV0900 for frame (Base-band frame) or packet (Transport Stream) output.
+ */
+static int stv090x_set_dfmt(struct stv090x_state *state, fe_data_format_t dfmt)
+{
+	u32 reg;
+
+	// Px_PDELCTRL2: Packet delineator additional configuration
+	switch(dfmt)
+	{
+		case FE_DFMT_TS_PACKET:
+			reg = STV090x_READ_DEMOD(state, PDELCTRL2);
+			STV090x_SETFIELD_Px(reg, FRAME_MODE_FIELD, 0);
+			if (STV090x_WRITE_DEMOD(state, PDELCTRL2, reg) < 0)
+				goto err;
+			break;
+		case FE_DFMT_BB_FRAME:
+			reg = STV090x_READ_DEMOD(state, PDELCTRL2);
+			STV090x_SETFIELD_Px(reg, FRAME_MODE_FIELD, 1);
+			if (STV090x_WRITE_DEMOD(state, PDELCTRL2, reg) < 0)
+				goto err;
+			break;
+		default:
+			dprintk(FE_ERROR, 1, "Invalid data format %d", dfmt);
+			goto err;
+	}
+	
+	//
+	return 0;
+err:
+	dprintk(FE_ERROR, 1, "Failed to set FE data format");
+	return -1;
+}
 
 static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state)
 {
@@ -3434,6 +3472,15 @@ 
 	if (p->frequency == 0)
 		return DVBFE_ALGO_SEARCH_INVALID;
 
+	if (tsout == 0) { /* bb mode enabled */
+		//if(stv090x_set_dfmt(state, props->dfmt) != 0)
+		if(stv090x_set_dfmt(state, FE_DFMT_BB_FRAME) != 0)
+			return DVBFE_ALGO_SEARCH_ERROR;
+	} else {
+		if(stv090x_set_dfmt(state, FE_DFMT_TS_PACKET) != 0)
+			return DVBFE_ALGO_SEARCH_ERROR;
+	}
+
 	state->delsys = props->delivery_system;
 	state->frequency = p->frequency;
 	state->srate = p->u.qpsk.symbol_rate;