MC preparation patches
Subsystems (12)
v6 cover MC preparation patches
Those are the same patches as sent at PATCH RFCv5, addressing most of the stuff pointed by Hans.
The only thing I didn't do yet is the removal of entity->parent, in favor of using, instead, entity->graph_obj.mdev. Such patch will be done latter on.
As the previous series:
The first 5 patches on this series ensures that all existing object types (entities, pads and links) will have an unique ID, as agreed at the MC workshop.
The next two patches add two debug functions, that helps with the tests of the MC changes. Both are enabled only if DEBUG or dynamic debug is enabled.
The first one just help to identify when the media_device register, remove and unregister functions are called. It helps to identify if those events happen before or after object creation.
The second one is more interesting: it hooks at the object init and remove functions and dump what's there at the new object when it got created. This is very useful to test the future patches, as we'll be able to track any topology changes.
Also, it demonstates the capability of the functions media_gobj_init() and media_gobj_remove() to track topology changes. Tracking topology changes is fundamental for the new API, in order to implement G_TOPOLOGY ioctl. They should contain, in the future, a callback to warn the several drivers envolved at the MC topology build about topology changes.
The last patch on this preparation series is just a renaming patch, that will avoid mess when future patches introduce the entity->interface links.
They're tested using the cx231xx and au0828 with V4L2 and DVB support.
Those are the new media_gobj_init debug messages when the device is probed:
[ 3357.988183] usb 1-2.4: media_gobj_init: id 0x00000001 entity#1: 'au8522 19-0047' [ 3357.989505] usb 1-2.4: media_gobj_init: id 0x01000001 pad#1: 'au8522 19-0047':0 [ 3357.990867] usb 1-2.4: media_gobj_init: id 0x01000002 pad#2: 'au8522 19-0047':1 [ 3357.992123] usb 1-2.4: media_gobj_init: id 0x01000003 pad#3: 'au8522 19-0047':2 [ 3357.996008] usb 1-2.4: media_gobj_init: id 0x00000002 entity#2: '(tuner unset)' [ 3357.997158] usb 1-2.4: media_gobj_init: id 0x01000004 pad#4: '(tuner unset)':0 [ 3358.488779] usb 1-2.4: media_gobj_init: id 0x00000003 entity#3: 'au0828a video' [ 3358.490177] usb 1-2.4: media_gobj_init: id 0x01000005 pad#5: 'au0828a video':0 [ 3358.491944] usb 1-2.4: media_gobj_init: id 0x00000004 entity#4: 'au0828a vbi' [ 3358.493382] usb 1-2.4: media_gobj_init: id 0x01000006 pad#6: 'au0828a vbi':0 [ 3358.510977] usb 1-2.4: media_gobj_init: id 0x00000005 entity#5: 'Auvitek AU8522 QAM/8VSB Frontend' [ 3358.512441] usb 1-2.4: media_gobj_init: id 0x01000007 pad#7: 'Auvitek AU8522 QAM/8VSB Frontend':0 [ 3358.513909] usb 1-2.4: media_gobj_init: id 0x01000008 pad#8: 'Auvitek AU8522 QAM/8VSB Frontend':1 [ 3358.516828] usb 1-2.4: media_gobj_init: id 0x00000006 entity#6: 'dvb-demux' [ 3358.518226] usb 1-2.4: media_gobj_init: id 0x01000009 pad#9: 'dvb-demux':0 [ 3358.519594] usb 1-2.4: media_gobj_init: id 0x0100000a pad#10: 'dvb-demux':1 [ 3358.522461] usb 1-2.4: media_gobj_init: id 0x00000007 entity#7: 'dvb-dvr' [ 3358.523914] usb 1-2.4: media_gobj_init: id 0x0100000b pad#11: 'dvb-dvr':0 [ 3358.526625] usb 1-2.4: media_gobj_init: id 0x00000008 entity#8: 'dvb-net' [ 3358.529307] usb 1-2.4: media_gobj_init: id 0x02000001 link#1: 'Xceive XC5000' pad#4 ==> 'Auvitek AU8522 QAM/8VSB Frontend' pad#7 [ 3358.530715] usb 1-2.4: media_gobj_init: id 0x02000002 link#2: 'Xceive XC5000' pad#4 ==> 'Auvitek AU8522 QAM/8VSB Frontend' pad#7 [ 3358.532116] usb 1-2.4: media_gobj_init: id 0x02000003 link#3: 'Auvitek AU8522 QAM/8VSB Frontend' pad#8 ==> 'dvb-demux' pad#9 [ 3358.533520] usb 1-2.4: media_gobj_init: id 0x02000004 link#4: 'Auvitek AU8522 QAM/8VSB Frontend' pad#8 ==> 'dvb-demux' pad#9 [ 3358.534957] usb 1-2.4: media_gobj_init: id 0x02000005 link#5: 'dvb-demux' pad#10 ==> 'dvb-dvr' pad#11 [ 3358.536278] usb 1-2.4: media_gobj_init: id 0x02000006 link#6: 'dvb-demux' pad#10 ==> 'dvb-dvr' pad#11 [ 3358.610351] usb 1-2.4: media_gobj_init: id 0x02000007 link#7: 'Xceive XC5000' pad#4 ==> 'au8522 19-0047' pad#1 [ 3358.611455] usb 1-2.4: media_gobj_init: id 0x02000008 link#8: 'Xceive XC5000' pad#4 ==> 'au8522 19-0047' pad#1 [ 3358.612539] usb 1-2.4: media_gobj_init: id 0x02000009 link#9: 'au8522 19-0047' pad#2 ==> 'au0828a video' pad#5 [ 3358.613611] usb 1-2.4: media_gobj_init: id 0x0200000a link#10: 'au8522 19-0047' pad#2 ==> 'au0828a video' pad#5 [ 3358.614686] usb 1-2.4: media_gobj_init: id 0x0200000b link#11: 'au8522 19-0047' pad#3 ==> 'au0828a vbi' pad#6 [ 3358.615720] usb 1-2.4: media_gobj_init: id 0x0200000c link#12: 'au8522 19-0047' pad#3 ==> 'au0828a vbi' pad#6
Please notice that I changed the log messages there in order to put both the global ID and the local ID together. Now, all log messages will look the same:
media_gobj_init: id 0x0100000a pad#10: 'dvb-demux':1
=============== ============= ====== ============= Event name Global ID Local ID Obj-specific data
I think that this way, the logs become clearer and easier to read. I also added the pad index on the logs (as shown above).
Mauro Carvalho Chehab (8):
[media] media: create a macro to get entity ID
[media] media: add a common struct to be embed on media graph objects [media] media: use media_gobj inside entities
[media] media: use media_gobj inside pads
[media] media: use media_gobj inside links
[media] media: add messages when media device gets (un)registered [media] media: add a debug message to warn about gobj creation/removal [media] media: rename the function that create pad links
Documentation/media-framework.txt | 2 +- drivers/media/dvb-core/dvbdev.c | 8 +- drivers/media/i2c/s5c73m3/s5c73m3-core.c | 4 +- drivers/media/i2c/s5k5baf.c | 2 +- drivers/media/i2c/smiapp/smiapp-core.c | 4 +- drivers/media/media-device.c | 41 +++++-- drivers/media/media-entity.c | 127 ++++++++++++++++++++- drivers/media/platform/exynos4-is/media-dev.c | 16 +-- drivers/media/platform/omap3isp/isp.c | 18 +-- drivers/media/platform/omap3isp/ispccdc.c | 2 +- drivers/media/platform/omap3isp/ispccp2.c | 2 +- drivers/media/platform/omap3isp/ispcsi2.c | 2 +- drivers/media/platform/omap3isp/isppreview.c | 4 +- drivers/media/platform/omap3isp/ispresizer.c | 4 +- drivers/media/platform/s3c-camif/camif-core.c | 4 +- drivers/media/platform/vsp1/vsp1_drv.c | 4 +- drivers/media/platform/vsp1/vsp1_rpf.c | 2 +- drivers/media/platform/vsp1/vsp1_video.c | 4 +- drivers/media/platform/vsp1/vsp1_wpf.c | 2 +- drivers/media/platform/xilinx/xilinx-vipp.c | 4 +- drivers/media/usb/au0828/au0828-core.c | 6 +- drivers/media/usb/cx231xx/cx231xx-cards.c | 6 +- drivers/media/usb/uvc/uvc_entity.c | 2 +- drivers/staging/media/davinci_vpfe/dm365_ipipeif.c | 2 +- drivers/staging/media/davinci_vpfe/dm365_isif.c | 2 +- drivers/staging/media/davinci_vpfe/dm365_resizer.c | 8 +- .../staging/media/davinci_vpfe/vpfe_mc_capture.c | 10 +- drivers/staging/media/omap4iss/iss.c | 12 +- drivers/staging/media/omap4iss/iss_csi2.c | 2 +- drivers/staging/media/omap4iss/iss_ipipeif.c | 2 +- drivers/staging/media/omap4iss/iss_resizer.c | 2 +- include/media/media-device.h | 7 +- include/media/media-entity.h | 84 +++++++++++++- 33 files changed, 311 insertions(+), 90 deletions(-)
Signature · 1 line
2.4.3
PATCH v6 1/8 media: create a macro to get entity ID
Instead of accessing directly entity.id, let's create a macro, as this field will be moved into a common struct later on.
drivers/media/media-device.c +4 -4
@@ -77,8 +77,8 @@ static struct media_entity *find_entity(struct media_device *mdev, u32 id)spin_lock (&mdev->lock);media_device_for_each_entity (entity, mdev) { -if ((entity->id = id && !next) || - (entity->id > id && next)) { +if (((media_entity_id (entity) = id) && !next) || + ((media_entity_id (entity) > id) && next)) {spin_unlock (&mdev->lock);return entity; }
@@ -104,7 +104,7 @@ static long media_device_enum_entities(struct media_device *mdev,if (ent =NULL )return -EINVAL ; - u_ent.id = ent->id; + u_ent.id =media_entity_id (ent);if (ent->name)strlcpy (u_ent.name, ent->name,sizeof (u_ent.name)); u_ent.type = ent->type;
@@ -122,7 +122,7 @@ static long media_device_enum_entities(struct media_device *mdev,static void media_device_kpad_to_upad (const struct media_pad *kpad,struct media_pad_desc *upad) { - upad->entity = kpad->entity->id; + upad->entity =media_entity_id (kpad->entity); upad->index = kpad->index; upad->flags = kpad->flags; }
drivers/media/media-entity.c +4 -4
@@ -140,10 +140,10 @@ void media_entity_graph_walk_start(struct media_entity_graph *graph, graph->stack[graph->top].entity =NULL ;bitmap_zero (graph->entities,MEDIA_ENTITY_ENUM_MAX_ID ); -if (WARN_ON (entity->id >=MEDIA_ENTITY_ENUM_MAX_ID )) +if (WARN_ON (media_entity_id (entity) >=MEDIA_ENTITY_ENUM_MAX_ID ))return ; -__set_bit (entity->id, graph->entities); +__set_bit (media_entity_id (entity), graph->entities);stack_push (graph, entity); }EXPORT_SYMBOL_GPL (media_entity_graph_walk_start);
@@ -184,11 +184,11 @@ media_entity_graph_walk_next(struct media_entity_graph *graph)/* Get the entity in the other end of the link . */ next =media_entity_other (entity, link); -if (WARN_ON (next->id >=MEDIA_ENTITY_ENUM_MAX_ID )) +if (WARN_ON (media_entity_id (next) >=MEDIA_ENTITY_ENUM_MAX_ID ))return NULL ;/* Has the entity already been visited? */ -if (__test_and_set_bit (next->id, graph->entities)) { +if (__test_and_set_bit (media_entity_id (next), graph->entities)) {link_top (graph)++;continue ; }
drivers/media/platform/vsp1/vsp1_video.c +2 -2
@@ -352,10 +352,10 @@ static int vsp1_pipeline_validate_branch(struct vsp1_pipeline *pipe,break ;/* Ensure the branch has no loop. */ -if (entities & (1 << entity->subdev.entity.id)) +if (entities & (1 <<media_entity_id (&entity->subdev.entity)))return -EPIPE ; - entities |=1 << entity->subdev.entity.id; + entities |=1 <<media_entity_id (&entity->subdev.entity);/* UDS can't be chained. */ if (entity->type =VSP1_ENTITY_UDS ) {
include/media/media-entity.h +5 -0
@@ -113,6 +113,11 @@ static inline u32 media_entity_subtype(struct media_entity *entity)return entity->type &MEDIA_ENT_SUBTYPE_MASK ; } +static inline u32 media_entity_id (struct media_entity *entity) +{ +return entity->id; +} +#define MEDIA_ENTITY_ENUM_MAX_DEPTH 16#define MEDIA_ENTITY_ENUM_MAX_ID 64
Signature · 1 line
2.4.3
Laurent Pinchart
maintainerRe: [PATCH v6 1/8] [media] media: create a macro to get entity ID
Hi Mauro,
Thank you for the patch.
Quoted 80 lines · On Wednesday 19 August 2015 08:01:48 Mauro Carvalho Chehab wrote:
Instead of accessing directly entity.id, let's create a macro, as this field will be moved into a common struct later on.
Signed-off-by Mauro Carvalho Chehab <[email protected]>Acked-by Hans Verkuil <[email protected]>Signed-off-by Mauro Carvalho Chehab <[email protected]>drivers/media/media-device.c +3
-3@@ -77,8 +77,8 @@ static struct media_entity *find_entity(struct media_device *mdev, u32 id) spin_lock(&mdev->lock);media_device_for_each_entity (entity, mdev) { -if ((entity->id = id && !next) || - (entity->id > id && next)) { +if (((media_entity_id (entity) = id) && !next) || + ((media_entity_id (entity) > id) && next)) {spin_unlock (&mdev->lock);return entity; }@@ -104,7 +104,7 @@ static long media_device_enum_entities(struct media_device *mdev, if (ent = NULL) return -EINVAL; - u_ent.id = ent->id; + u_ent.id =media_entity_id (ent);if (ent->name)strlcpy (u_ent.name, ent->name,sizeof (u_ent.name)); u_ent.type = ent->type;@@ -122,7 +122,7 @@ static long media_device_enum_entities(struct
media_device*mdev, static voidmedia_device_kpad_to_upad(const struct media_pad *kpad, struct media_pad_desc *upad)
{drivers/media/media-device.c +1
-1- upad->entity = kpad->entity->id; + upad->entity =media_entity_id (kpad->entity); upad->index = kpad->index; upad->flags = kpad->flags; }drivers/media/media-entity.c +4
-4@@ -140,10 +140,10 @@ void media_entity_graph_walk_start(struct media_entity_graph *graph, graph->stack[graph->top].entity =NULL ;bitmap_zero (graph->entities,MEDIA_ENTITY_ENUM_MAX_ID ); -if (WARN_ON (entity->id >=MEDIA_ENTITY_ENUM_MAX_ID )) +if (WARN_ON (media_entity_id (entity) >=MEDIA_ENTITY_ENUM_MAX_ID ))return ; -__set_bit (entity->id, graph->entities); +__set_bit (media_entity_id (entity), graph->entities);stack_push (graph, entity); }EXPORT_SYMBOL_GPL (media_entity_graph_walk_start);@@ -184,11 +184,11 @@ media_entity_graph_walk_next(struct media_entity_graph *graph)/* Get the entity in the other end of the link . */ next =media_entity_other (entity, link); -if (WARN_ON (next->id >=MEDIA_ENTITY_ENUM_MAX_ID )) +if (WARN_ON (media_entity_id (next) >=MEDIA_ENTITY_ENUM_MAX_ID ))return NULL ;/* Has the entity already been visited? */ -if (__test_and_set_bit (next->id, graph->entities)) { +if (__test_and_set_bit (media_entity_id (next), graph->entities)) {link_top (graph)++;continue ;drivers/media/media-entity.c +0
-0}(quoted diff) +0
-0
b/drivers/media/platform/vsp1/vsp1_video.cindex17f08973f835..debe4e539df6100644drivers/media/platform/vsp1/vsp1_video.c +0
-0@@ -352,10 +352,10 @@ static int vsp1_pipeline_validate_branch(structvsp1_pipeline *pipe, break;
drivers/media/platform/vsp1/vsp1_video.c static int vsp1_pipeline_validate_branch(struct · line 361
Quoted 10 lines
drivers/media/platform/vsp1/vsp1_video.c +2
-2/* Ensure the branch has no loop. */ -if (entities & (1 << entity->subdev.entity.id)) +if (entities & (1 <<media_entity_id (&entity->subdev.entity)))return -EPIPE ; - entities |=1 << entity->subdev.entity.id; + entities |=1 <<media_entity_id (&entity->subdev.entity);/* UDS can't be chained. */ if (entity->type =VSP1_ENTITY_UDS ) {
I would move the modification of the vsp1 driver to Javier's patch that modifies the OMAP3 and OMAP4 drivers. Alternatively you could squash them into this patch, but I believe having a first patch that adds the inline function and a second patch that modifies all drivers to use it would be better.
Quoted 15 lines
include/media/media-entity.h +5
-0@@ -113,6 +113,11 @@ static inline u32 media_entity_subtype(struct media_entity *entity) return entity->type & MEDIA_ENT_SUBTYPE_MASK; } +static inline u32 media_entity_id (struct media_entity *entity) +{ +return entity->id; +} +#define MEDIA_ENTITY_ENUM_MAX_DEPTH 16#define MEDIA_ENTITY_ENUM_MAX_ID 64
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v6 1/8] [media] media: create a macro to get entity ID
Em Fri, 21 Aug 2015 03:40:48 +0300
Laurent Pinchart <[email protected]> escreveu:
Quoted 93 lines
Hi Mauro,
Thank you for the patch.
Quoted 88 lines · On Wednesday 19 August 2015 08:01:48 Mauro Carvalho Chehab wrote:
Instead of accessing directly entity.id, let's create a macro, as this field will be moved into a common struct later on.
Signed-off-by Mauro Carvalho Chehab <[email protected]>Acked-by Hans Verkuil <[email protected]>Signed-off-by Mauro Carvalho Chehab <[email protected]>drivers/media/media-device.c +3
-3@@ -77,8 +77,8 @@ static struct media_entity *find_entity(struct media_device *mdev, u32 id) spin_lock(&mdev->lock);media_device_for_each_entity (entity, mdev) { -if ((entity->id = id && !next) || - (entity->id > id && next)) { +if (((media_entity_id (entity) = id) && !next) || + ((media_entity_id (entity) > id) && next)) {spin_unlock (&mdev->lock);return entity; }@@ -104,7 +104,7 @@ static long media_device_enum_entities(struct media_device *mdev, if (ent = NULL) return -EINVAL; - u_ent.id = ent->id; + u_ent.id =media_entity_id (ent);if (ent->name)strlcpy (u_ent.name, ent->name,sizeof (u_ent.name)); u_ent.type = ent->type;@@ -122,7 +122,7 @@ static long media_device_enum_entities(struct
media_device*mdev, static voidmedia_device_kpad_to_upad(const struct media_pad *kpad, struct media_pad_desc *upad)
{drivers/media/media-device.c +1
-1- upad->entity = kpad->entity->id; + upad->entity =media_entity_id (kpad->entity); upad->index = kpad->index; upad->flags = kpad->flags; }drivers/media/media-entity.c +4
-4@@ -140,10 +140,10 @@ void media_entity_graph_walk_start(struct media_entity_graph *graph, graph->stack[graph->top].entity =NULL ;bitmap_zero (graph->entities,MEDIA_ENTITY_ENUM_MAX_ID ); -if (WARN_ON (entity->id >=MEDIA_ENTITY_ENUM_MAX_ID )) +if (WARN_ON (media_entity_id (entity) >=MEDIA_ENTITY_ENUM_MAX_ID ))return ; -__set_bit (entity->id, graph->entities); +__set_bit (media_entity_id (entity), graph->entities);stack_push (graph, entity); }EXPORT_SYMBOL_GPL (media_entity_graph_walk_start);@@ -184,11 +184,11 @@ media_entity_graph_walk_next(struct media_entity_graph *graph)/* Get the entity in the other end of the link . */ next =media_entity_other (entity, link); -if (WARN_ON (next->id >=MEDIA_ENTITY_ENUM_MAX_ID )) +if (WARN_ON (media_entity_id (next) >=MEDIA_ENTITY_ENUM_MAX_ID ))return NULL ;/* Has the entity already been visited? */ -if (__test_and_set_bit (next->id, graph->entities)) { +if (__test_and_set_bit (media_entity_id (next), graph->entities)) {link_top (graph)++;continue ;drivers/media/media-entity.c +0
-0}(quoted diff) +0
-0
b/drivers/media/platform/vsp1/vsp1_video.cindex17f08973f835..debe4e539df6100644drivers/media/platform/vsp1/vsp1_video.c +2
-2@@ -352,10 +352,10 @@ static int vsp1_pipeline_validate_branch(structvsp1_pipeline *pipe, break;/* Ensure the branch has no loop. */ -if (entities & (1 << entity->subdev.entity.id)) +if (entities & (1 <<media_entity_id (&entity->subdev.entity)))return -EPIPE ; - entities |=1 << entity->subdev.entity.id; + entities |=1 <<media_entity_id (&entity->subdev.entity);
Quoted 7 lines
drivers/media/platform/vsp1/vsp1_video.c static int vsp1_pipeline_validate_branch(struct vsp1_pipeline *pipe, · line 361
Quoted 2 lines
drivers/media/platform/vsp1/vsp1_video.c +0
-0/* UDS can't be chained. */ if (entity->type =VSP1_ENTITY_UDS ) {I would move the modification of the vsp1 driver to Javier's patch that modifies the OMAP3 and OMAP4 drivers. Alternatively you could squash them into this patch, but I believe having a first patch that adds the inline function and a second patch that modifies all drivers to use it would be better.
Squashing will lose Javier's authorship. I guess the better is have a first patch with the inline, then my paches and Javier's ones, and latter on the patch removing entity->id.
I'll do that on the next patch series.
Quoted 17 lines
Quoted 16 lines
include/media/media-entity.h +5
-0@@ -113,6 +113,11 @@ static inline u32 media_entity_subtype(struct media_entity *entity) return entity->type & MEDIA_ENT_SUBTYPE_MASK; } +static inline u32 media_entity_id (struct media_entity *entity) +{ +return entity->id; +} +#define MEDIA_ENTITY_ENUM_MAX_DEPTH 16#define MEDIA_ENTITY_ENUM_MAX_ID 64
Laurent Pinchart
maintainerRe: [PATCH v6 1/8] [media] media: create a macro to get entity ID
Hi Mauro,
Quoted 8 lines · On Friday 21 August 2015 05:42:29 Mauro Carvalho Chehab wrote:
Em Fri, 21 Aug 2015 03:40:48 +0300 Laurent Pinchart escreveu:
Quoted 7 lines · On Wednesday 19 August 2015 08:01:48 Mauro Carvalho Chehab wrote:
Quoted 6 lines
Instead of accessing directly entity.id, let's create a macro, as this field will be moved into a common struct later on.
Signed-off-by Mauro Carvalho Chehab <[email protected]>Acked-by Hans Verkuil <[email protected]>Signed-off-by Mauro Carvalho Chehab <[email protected]>
[snip]
Quoted 27 lines
Quoted 18 lines
Quoted 18 lines
(quoted diff) +0
-0
b/drivers/media/platform/vsp1/vsp1_video.cindex17f08973f835..debe4e539df6
100644drivers/media/platform/vsp1/vsp1_video.c +2
-2@@ -352,10 +352,10 @@ static int vsp1_pipeline_validate_branch(structvsp1_pipeline *pipe, break;/* Ensure the branch has no loop. */ -if (entities & (1 << entity->subdev.entity.id)) +if (entities & (1 <<media_entity_id (&entity->subdev.entity)))return -EPIPE ; - entities |=1 << entity->subdev.entity.id; + entities |=1 <<media_entity_id (&entity->subdev.entity);Quoted 8 lines
Quoted 2 lines
drivers/media/platform/vsp1/vsp1_video.c +0
-0/* UDS can't be chained. */ if (
entity->type=VSP1_ENTITY_UDS) {I would move the modification of the vsp1 driver to Javier's patch that modifies the OMAP3 and OMAP4 drivers. Alternatively you could squash them into this patch, but I believe having a first patch that adds the inline function and a second patch that modifies all drivers to use it would be better.
Quoted 3 lines
Squashing will lose Javier's authorship. I guess the better is have a first patch with the inline, then my paches and Javier's ones, and latter on the patch removing
entity->id.
What I meant is
1. This patch without the VSP1 chunk, with your authorship
2. Javier's patches for OMAP3 and OMAP4 + the VSP1 chunk squashed in a single patch, with Javier's authorship
3. Javier's patch removing entity->id, with Javier's authorship
I don't see a need to split usage of media_entity_id() into per-driver patches.
Quoted 19 lines
I'll do that on the next patch series.
Quoted 17 lines
Quoted 17 lines
include/media/media-entity.h +5
-0@@ -113,6 +113,11 @@ static inline u32 media_entity_subtype(struct media_entity *entity) return entity->type & MEDIA_ENT_SUBTYPE_MASK; } +static inline u32 media_entity_id (struct media_entity *entity) +{ +return entity->id; +} +#define MEDIA_ENTITY_ENUM_MAX_DEPTH 16#define
MEDIA_ENTITY_ENUM_MAX_ID64
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v6 1/8] [media] media: create a macro to get entity ID
Em Fri, 21 Aug 2015 20:27:19 +0300
Laurent Pinchart <[email protected]> escreveu:
Quoted 45 lines
Hi Mauro,
Quoted 8 lines · On Friday 21 August 2015 05:42:29 Mauro Carvalho Chehab wrote:
Em Fri, 21 Aug 2015 03:40:48 +0300 Laurent Pinchart escreveu:
Quoted 7 lines · On Wednesday 19 August 2015 08:01:48 Mauro Carvalho Chehab wrote:
Quoted 6 lines
Instead of accessing directly entity.id, let's create a macro, as this field will be moved into a common struct later on.
Signed-off-by Mauro Carvalho Chehab <[email protected]>Acked-by Hans Verkuil <[email protected]>Signed-off-by Mauro Carvalho Chehab <[email protected]>[snip]
Quoted 27 lines
Quoted 18 lines
Quoted 18 lines
(quoted diff) +0
-0
b/drivers/media/platform/vsp1/vsp1_video.cindex17f08973f835..debe4e539df6
100644drivers/media/platform/vsp1/vsp1_video.c +2
-2@@ -352,10 +352,10 @@ static int vsp1_pipeline_validate_branch(structvsp1_pipeline *pipe, break;/* Ensure the branch has no loop. */ -if (entities & (1 << entity->subdev.entity.id)) +if (entities & (1 <<media_entity_id (&entity->subdev.entity)))return -EPIPE ; - entities |=1 << entity->subdev.entity.id; + entities |=1 <<media_entity_id (&entity->subdev.entity);Quoted 8 lines
Quoted 2 lines
drivers/media/platform/vsp1/vsp1_video.c +0
-0/* UDS can't be chained. */ if (
entity->type=VSP1_ENTITY_UDS) {I would move the modification of the vsp1 driver to Javier's patch that modifies the OMAP3 and OMAP4 drivers. Alternatively you could squash them into this patch, but I believe having a first patch that adds the inline function and a second patch that modifies all drivers to use it would be better.
Quoted 3 lines
Squashing will lose Javier's authorship. I guess the better is have a first patch with the inline, then my paches and Javier's ones, and latter on the patch removing
entity->id.
Quoted 6 lines
What I meant is
1. This patch without the VSP1 chunk, with your authorship
2. Javier's patches for OMAP3 and OMAP4 + the VSP1 chunk squashed in a single patch, with Javier's authorship
3. Javier's patch removingentity->id, with Javier's authorship
Actually, the removal of entity->id is at the first patch, with my authorship, but I got the idea ;)
Btw, this was noticed because Javier is testing the MC new gen on OMAP3. We should really enforce that all all drivers should compile with COMPILE_TEST, as otherwise we'll keep having troubles like that.
Regards,
Mauro
Laurent Pinchart
maintainerRe: [PATCH v6 1/8] [media] media: create a macro to get entity ID
Hi Mauro,
Quoted 47 lines · On Friday 21 August 2015 14:45:35 Mauro Carvalho Chehab wrote:
Em Fri, 21 Aug 2015 20:27:19 +0300 Laurent Pinchart escreveu:
Quoted 46 lines · On Friday 21 August 2015 05:42:29 Mauro Carvalho Chehab wrote:
Quoted 8 lines
Em Fri, 21 Aug 2015 03:40:48 +0300 Laurent Pinchart escreveu:
Quoted 7 lines · On Wednesday 19 August 2015 08:01:48 Mauro Carvalho Chehab wrote:
Quoted 6 lines
Instead of accessing directly entity.id, let's create a macro, as this field will be moved into a common struct later on.
Signed-off-by Mauro Carvalho Chehab <[email protected]>Acked-by Hans Verkuil <[email protected]>Signed-off-by Mauro Carvalho Chehab <[email protected]>[snip]
Quoted 28 lines
Quoted 19 lines
Quoted 19 lines
(quoted diff) +0
-0
b/drivers/media/platform/vsp1/vsp1_video.cindex17f08973f835..debe4e539df6
100644drivers/media/platform/vsp1/vsp1_video.c +0
-0@@ -352,10 +352,10 @@ static intvsp1_pipeline_validate_branch(struct
vsp1_pipeline*pipe,break;drivers/media/platform/vsp1/vsp1_video.c +2
-2/* Ensure the branch has no loop. */ -if (entities & (1 << entity->subdev.entity.id)) +if (entities & (1 <<media_entity_id (&entity->subdevntity)))return -EPIPE ; - entities |=1 << entity->subdev.entity.id; + entities |=1 <<media_entity_id (&entity->subdev.entity);Quoted 8 lines
drivers/media/platform/vsp1/vsp1_video.c static int vsp1_pipeline_validate_branch(struct vsp1_pipeline *pipe, · line 361
Quoted 2 lines
drivers/media/platform/vsp1/vsp1_video.c +0
-0/* UDS can't be chained. */ if (entity->type =VSP1_ENTITY_UDS ) {I would move the modification of the vsp1 driver to Javier's patch that modifies the OMAP3 and OMAP4 drivers. Alternatively you could squash them into this patch, but I believe having a first patch that adds the inline function and a second patch that modifies all drivers to use it would be better.
Quoted 3 lines
Squashing will lose Javier's authorship. I guess the better is have a first patch with the inline, then my paches and Javier's ones, and latter on the patch removing
entity->id.What I meant is
Quoted 7 lines
Quoted 4 lines
1. This patch without the VSP1 chunk, with your authorship
2. Javier's patches for OMAP3 and OMAP4 + the VSP1 chunk squashed in a single patch, with Javier's authorship
3. Javier's patch removingentity->id, with Javier's authorshipActually, the removal of
entity->idis at the first patch, with my authorship, but I got the idea ;)
I'm not sure to follow you. The first patch is this one, and it doesn't remove the id field from struct media_entity.
Quoted 3 lines
Btw, this was noticed because Javier is testing the MC new gen on OMAP3. We should really enforce that all all drivers should compile with
COMPILE_TEST, as otherwise we'll keep having troubles like that.
I agree with that. I've just sent a patch to enable compilation of the omap3isp driver with COMPILE_TEST. There's still a compile-time dependency on ARM, as well as a dependency on OMAP_IOMMU which currently depends on OMAP, but that can be fixed independently.
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v6 1/8] [media] media: create a macro to get entity ID
Em Fri, 21 Aug 2015 21:11:57 +0300
Laurent Pinchart <[email protected]> escreveu:
Quoted 55 lines
Hi Mauro,
Quoted 52 lines · On Friday 21 August 2015 14:45:35 Mauro Carvalho Chehab wrote:
Em Fri, 21 Aug 2015 20:27:19 +0300 Laurent Pinchart escreveu:
Quoted 50 lines · On Friday 21 August 2015 05:42:29 Mauro Carvalho Chehab wrote:
Quoted 8 lines
Em Fri, 21 Aug 2015 03:40:48 +0300 Laurent Pinchart escreveu:
Quoted 7 lines · On Wednesday 19 August 2015 08:01:48 Mauro Carvalho Chehab wrote:
Quoted 6 lines
Instead of accessing directly entity.id, let's create a macro, as this field will be moved into a common struct later on.
Signed-off-by Mauro Carvalho Chehab <[email protected]>Acked-by Hans Verkuil <[email protected]>Signed-off-by Mauro Carvalho Chehab <[email protected]>[snip]
Quoted 28 lines
Quoted 19 lines
Quoted 19 lines
(quoted diff) +0
-0
b/drivers/media/platform/vsp1/vsp1_video.cindex17f08973f835..debe4e539df6
100644drivers/media/platform/vsp1/vsp1_video.c +0
-0@@ -352,10 +352,10 @@ static intvsp1_pipeline_validate_branch(struct
vsp1_pipeline*pipe,break;drivers/media/platform/vsp1/vsp1_video.c +2
-2/* Ensure the branch has no loop. */ -if (entities & (1 << entity->subdev.entity.id)) +if (entities & (1 <<media_entity_id (&entity->subdevntity)))return -EPIPE ; - entities |=1 << entity->subdev.entity.id; + entities |=1 <<media_entity_id (&entity->subdev.entity);Quoted 8 lines
drivers/media/platform/vsp1/vsp1_video.c static int vsp1_pipeline_validate_branch(struct vsp1_pipeline *pipe, · line 361
Quoted 2 lines
drivers/media/platform/vsp1/vsp1_video.c +0
-0/* UDS can't be chained. */ if (entity->type =VSP1_ENTITY_UDS ) {I would move the modification of the vsp1 driver to Javier's patch that modifies the OMAP3 and OMAP4 drivers. Alternatively you could squash them into this patch, but I believe having a first patch that adds the inline function and a second patch that modifies all drivers to use it would be better.
Quoted 3 lines
Squashing will lose Javier's authorship. I guess the better is have a first patch with the inline, then my paches and Javier's ones, and latter on the patch removing
entity->id.What I meant is
1. This patch without the VSP1 chunk, with your authorship
2. Javier's patches for OMAP3 and OMAP4 + the VSP1 chunk squashed in a single patch, with Javier's authorship
3. Javier's patch removingentity->id, with Javier's authorship
Quoted 5 lines
Quoted 2 lines
Actually, the removal of
entity->idis at the first patch, with my authorship, but I got the idea ;)I'm not sure to follow you. The first patch is this one, and it doesn't remove the id field from struct
media_entity.
Sorry, I meant to say "the first patch series I submitted after the workshop", e. .g RFC v1.
Quoted 8 lines
Quoted 3 lines
Btw, this was noticed because Javier is testing the MC new gen on OMAP3. We should really enforce that all all drivers should compile with
COMPILE_TEST, as otherwise we'll keep having troubles like that.I agree with that. I've just sent a patch to enable compilation of the omap3isp driver with
COMPILE_TEST. There's still a compile-time dependency on ARM, as well as a dependency onOMAP_IOMMUwhich currently depends on OMAP, but that can be fixed independently.
See the comments for the patch.
Regards,
Mauro
PATCH v6 2/8 media: add a common struct to be embed on media graph objects
In reply to Mauro Carvalho ChehabDue to the MC API proposed changes, we'll need to have an unique object ID for all graph objects, and have some shared fields that will be common on all media graph objects.
Right now, the only common object is the object ID, but other fields will be added later on.
drivers/media/media-entity.c +32 -0
@@ -27,6 +27,38 @@#include <media/media-device.h> /** +* media_gobj_init - Initialize a graph object +* +* @mdev: Pointer to the media_device that contains the object +* @type: Type of the object +* @gobj: Pointer to the object +* +* This routine initializes the embedded struct media_gobj inside a +* media graph object. It is called automatically if media_*_create() +* calls are used. However, if the object (entity, link, pad, interface) +* is embedded on some other object, this function should be called before +* registering the object at the media controller. +*/ +void media_gobj_init (struct media_device *mdev, +enum media_gobj_type type, +struct media_gobj *gobj) +{ +/* For now, nothing to do */ +} + +/** +* media_gobj_remove - Stop using a graph object on a media device +* +* @graph_obj: Pointer to the object +* +* This should be called at media_device_unregister_*() routines +*/ +void media_gobj_remove (struct media_gobj *gobj) +{ +/* For now, nothing to do */ +} + +/** * media_entity_init - Initialize a media entity * * @num_pads: Total number of sink and source pads.
include/media/media-entity.h +61 -0
79 lines not on this page · raw message
Signature · 1 line
2.4.3
Re: [PATCH v6 2/8] [media] media: add a common struct to be embed on media graph objects
Quoted 8 lines · Mauro Carvalho Chehab
Due to the MC API proposed changes, we'll need to have an unique object ID for all graph objects, and have some shared fields that will be common on all media graph objects.
Right now, the only common object is the object ID, but other fields will be added later on.
Signed-off-by Mauro Carvalho Chehab <[email protected]>
Thanks!
Hans
Laurent Pinchart
maintainerRe: [PATCH v6 2/8] [media] media: add a common struct to be embed on media graph objects
In reply to Mauro Carvalho ChehabHi Mauro,
Thank you for the patch.
Quoted 18 lines · On Wednesday 19 August 2015 08:01:49 Mauro Carvalho Chehab wrote:
Due to the MC API proposed changes, we'll need to have an unique object ID for all graph objects, and have some shared fields that will be common on all media graph objects.
Right now, the only common object is the object ID, but other fields will be added later on.
Signed-off-by Mauro Carvalho Chehab <[email protected]>drivers/media/media-entity.c +1
-0@@ -27,6 +27,38 @@#include <media/media-device.h> /** +* media_gobj_init - Initialize a graph object
drivers/media/media-entity.c line 40
Quoted 10 lines
drivers/media/media-entity.c +10
-0+* +* @mdev: Pointer to the media_device that contains the object +* @type: Type of the object +* @gobj: Pointer to the object +* +* This routine initializes the embedded struct media_gobj inside a +* media graph object. It is called automatically if media_*_create() +* calls are used. However, if the object (entity, link, pad, interface) +* is embedded on some other object, this function should be called before +* registering the object at the media controller.
Allowing both dynamic allocation and embedding will create a more complex API with more opportunities for drivers to get it wrong. I'd like to try and standardize the expected behaviour.
drivers/media/media-entity.c line 50
Quoted 10 lines
drivers/media/media-entity.c +10
-0+*/ +void media_gobj_init (struct media_device *mdev, +enum media_gobj_type type, +struct media_gobj *gobj) +{ +/* For now, nothing to do */ +} + +/** +* media_gobj_remove - Stop using a graph object on a media device
Is this function supposed to be the counterpart of media_gobj_init ? If so it should be called media_gobj_cleanup instead.
drivers/media/media-entity.c line 52
Quoted 2 lines
drivers/media/media-entity.c +2
-0+* +* @graph_obj: Pointer to the object
The parameter is called gobj. Could you compile the kerneldoc to ensure that such typos get caught ?
Quoted 17 lines
drivers/media/media-entity.c +9
-0+* +* This should be called at media_device_unregister_*() routines +*/ +void media_gobj_remove (struct media_gobj *gobj) +{ +/* For now, nothing to do */ +} + +/** * media_entity_init - Initialize a media entity * * @num_pads: Total number of sink and source pads. include/media/media-entity.h +0
-0
include/media/media-entity.h line 34
Quoted 7 lines
include/media/media-entity.h +4
-0@@ -28,6 +28,39 @@#include <linux/list.h> #include <linux/media.h> +/* Enums used internally at the media controller to represent graphs */ + +/** +* enum media_gobj_type - type of a graph element
Let's try to standardize the vocabulary, should it be called graph object or graph element ? In the first case let's document it as graph object. In the second case it would be more consistent to refer to it as enum media_gelem_type (and struct media_gelem below).
Quoted 11 lines
include/media/media-entity.h +11
-0+* +*/ +enum media_gobj_type { +/* FIXME: add the types here, as we embed media_gobj */ +MEDIA_GRAPH_NONE +}; + +#define MEDIA_BITS_PER_TYPE 8 +#define MEDIA_BITS_PER_LOCAL_ID (32 - MEDIA_BITS_PER_TYPE) +#define MEDIA_LOCAL_ID_MASK GENMASK(MEDIA_BITS_PER_LOCAL_ID - 1, 0) +
include/media/media-entity.h line 55
Quoted 10 lines
include/media/media-entity.h +10
-0+/* Structs to represent the objects that belong to a media graph */ + +/** +* struct media_gobj - Define a graph object. +* +* @id: Non-zero object ID identifier. The ID should be unique +* inside a media_device, as it is composed by +* MEDIA_BITS_PER_TYPE to store the type plus +* MEDIA_BITS_PER_LOCAL_ID to store a per-type ID +* (called as "local ID").
I'd very much prefer using a single ID range and adding a type field. Abusing bits of the ID field to store the type will just makes IDs impractical to use. Let's do it properly.
include/media/media-entity.h line 57
Quoted 1 line
include/media/media-entity.h +1
-0+* All elements on the media graph should have this struct embedded
All elements (objects) or only the ones that need an ID ? Or maybe we'll define graph element (object) as an element (object) that has an ID, making some "elements" not elements.
Quoted 38 lines
include/media/media-entity.h +26
-0+*/ +struct media_gobj { +u32 id; +}; + +struct media_pipeline { };@@ -118,6 +151,26 @@ static inline u32 media_entity_id(struct media_entity *entity) return entity->id; } +static inline enum media_gobj_type media_type (struct media_gobj *gobj) +{ +return gobj->id >>MEDIA_BITS_PER_LOCAL_ID ; +} + +static inline u32 media_localid (struct media_gobj *gobj) +{ +return gobj->id &MEDIA_LOCAL_ID_MASK ; +} + +static inline u32 media_gobj_gen_id (enum media_gobj_type type,u32 local_id) +{ +u32 id; + + id = type <<MEDIA_BITS_PER_LOCAL_ID ; + id |= local_id &MEDIA_LOCAL_ID_MASK ; + +return id; +} +#define MEDIA_ENTITY_ENUM_MAX_DEPTH 16#define MEDIA_ENTITY_ENUM_MAX_ID 64
include/media/media-entity.h struct media_entity_graph { · line 188
Quoted 5 lines
include/media/media-entity.h +2
-0@@ -131,6 +184,14 @@ struct media_entity_graph {int top; }; +#define gobj_to_entity (gobj) \ + container_of(gobj, struct media_entity, graph_obj)
For consistency reason would this be called media_gobj_to_entity ? I would also turn it into an inline function to ensure type checking.
Quoted 9 lines
include/media/media-entity.h +6
-0+ +void media_gobj_init (struct media_device *mdev, +enum media_gobj_type type, +struct media_gobj *gobj); +void media_gobj_remove (struct media_gobj *gobj); +int media_entity_init (struct media_entity *entity,u16 num_pads,struct media_pad *pads);void media_entity_cleanup (struct media_entity *entity);
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v6 2/8] [media] media: add a common struct to be embed on media graph objects
Quoted 5 lines · Laurent Pinchart
Hi Mauro,
Thank you for the patch.
On Wednesday 19 August 2015 08:01:49 Mauro Carvalho Chehab wrote:
Quoted 9 lines
include/media/media-entity.h line 34
Quoted 4 lines
include/media/media-entity.h +4
-0+/* Enums used internally at the media controller to represent graphs */ + +/** +* enum media_gobj_type - type of a graph element Let's try to standardize the vocabulary, should it be called graph object or graph element ? In the first case let's document it as graph object. In the second case it would be more consistent to refer to it as enum
media_gelem_type(and structmedia_gelembelow).
For what it is worth, I prefer the term graph object.
Quoted 18 lines
Quoted 18 lines
+ *
+ */include/media/media-entity.h +15
-0+enum media_gobj_type { +/* FIXME: add the types here, as we embed media_gobj */ +MEDIA_GRAPH_NONE +}; + +#define MEDIA_BITS_PER_TYPE 8 +#define MEDIA_BITS_PER_LOCAL_ID (32 - MEDIA_BITS_PER_TYPE) +#define MEDIA_LOCAL_ID_MASK GENMASK(MEDIA_BITS_PER_LOCAL_ID - 1, 0) + +/* Structs to represent the objects that belong to a media graph */ + +/** +* struct media_gobj - Define a graph object. +* +* @id: Non-zero object ID identifier. The ID should be unique
Quoted 8 lines
Quoted 4 lines
+ * inside a
media_device, as it is composed by
+ *MEDIA_BITS_PER_TYPEto store the type plus
+ *MEDIA_BITS_PER_LOCAL_IDto store a per-type ID
+ * (called as "local ID").I'd very much prefer using a single ID range and adding a type field. Abusing bits of the ID field to store the type will just makes IDs impractical to use. Let's do it properly.
Why is that impractical? I think it is more practical. Why waste memory on something that is easy to encode in the ID?
I'm not necessarily opposed to splitting this up (Mauro's initial patch series used a separate type field if I remember correctly), but it's not clear to me what the benefits are. Keeping it in a single u32 makes describing links also very easy since you just give it the two objects that are linked and it is immediately clear which object types are linked: no need to either store the types in the link struct or look up each object to find the type.
Quoted 6 lines
Quoted 2 lines
+ * All elements on the media graph should have this struct embedded
All elements (objects) or only the ones that need an ID ? Or maybe we'll define graph element (object) as an element (object) that has an ID, making some "elements" not elements.
Yes, all objects have an ID. I see no reason to special-case this.
You wrote this at 3 am, so you were probably sleep-deprived when you wrote the second sentence as I can't wrap my head around that one :-)
Quoted 42 lines
Quoted 42 lines
+ */
include/media/media-entity.h +25
-0+struct media_gobj { +u32 id; +}; + +struct media_pipeline { };@@ -118,6 +151,26 @@ static inline u32 media_entity_id(struct media_entity *entity) return entity->id; } +static inline enum media_gobj_type media_type (struct media_gobj *gobj) +{ +return gobj->id >>MEDIA_BITS_PER_LOCAL_ID ; +} + +static inline u32 media_localid (struct media_gobj *gobj) +{ +return gobj->id &MEDIA_LOCAL_ID_MASK ; +} + +static inline u32 media_gobj_gen_id (enum media_gobj_type type,u32 local_id) +{ +u32 id; + + id = type <<MEDIA_BITS_PER_LOCAL_ID ; + id |= local_id &MEDIA_LOCAL_ID_MASK ; + +return id; +} +#define MEDIA_ENTITY_ENUM_MAX_DEPTH 16#define MEDIA_ENTITY_ENUM_MAX_ID 64@@ -131,6 +184,14 @@ struct media_entity_graph {int top; };
Quoted 5 lines
include/media/media-entity.h struct media_entity_graph { · line 188
Quoted 2 lines
include/media/media-entity.h +2
-0+#define gobj_to_entity (gobj) \ + container_of(gobj, struct media_entity, graph_obj)For consistency reason would this be called
media_gobj_to_entity? I would also turn it into an inline function to ensure type checking.
Good one. I agree.
Quoted 11 lines
include/media/media-entity.h struct media_entity_graph { · line 197
Quoted 10 lines
include/media/media-entity.h +6
-0+ +void media_gobj_init (struct media_device *mdev, +enum media_gobj_type type, +struct media_gobj *gobj); +void media_gobj_remove (struct media_gobj *gobj); +int media_entity_init (struct media_entity *entity,u16 num_pads,struct media_pad *pads);void media_entity_cleanup (struct media_entity *entity);
Regards,
Hans
Laurent Pinchart
maintainerRe: [PATCH v6 2/8] [media] media: add a common struct to be embed on media graph objects
Hi Hans,
Quoted 12 lines · On Friday 21 August 2015 10:07:36 Hans Verkuil wrote:
Quoted 10 lines · Laurent Pinchart
include/media/media-entity.h line 34
Quoted 4 lines · On Wednesday 19 August 2015 08:01:49 Mauro Carvalho Chehab wrote:
include/media/media-entity.h +4
-0+/* Enums used internally at the media controller to represent graphs */ + +/** +* enum media_gobj_type - type of a graph element Let's try to standardize the vocabulary, should it be called graph object or graph element ? In the first case let's document it as graph object. In the second case it would be more consistent to refer to it as enum
media_gelem_type(and structmedia_gelembelow).
Quoted 1 line
For what it is worth, I prefer the term graph object.
So do I.
Quoted 10 lines
Quoted 10 lines
include/media/media-entity.h
Quoted 10 lines
+ *
+ */include/media/media-entity.h +8
-0+enum media_gobj_type { +/* FIXME: add the types here, as we embed media_gobj */ +MEDIA_GRAPH_NONE +}; + +#define MEDIA_BITS_PER_TYPE 8 +#define MEDIA_BITS_PER_LOCAL_ID (32 - MEDIA_BITS_PER_TYPE) +#define MEDIA_LOCAL_ID_MASK GENMASK(MEDIA_BITS_PER_LOCAL_ID - 1,
0)
Quoted 29 lines
Quoted 7 lines
Quoted 7 lines
include/media/media-entity.h +7
-0+ +/* Structs to represent the objects that belong to a media graph */ + +/** +* struct media_gobj - Define a graph object. +* +* @id: Non-zero object ID identifier. The ID should be unique Quoted 8 lines
Quoted 4 lines
+ * inside a
media_device, as it is composed by
+ *MEDIA_BITS_PER_TYPEto store the type plus
+ *MEDIA_BITS_PER_LOCAL_IDto store a per-type ID
+ * (called as "local ID").I'd very much prefer using a single ID range and adding a type field. Abusing bits of the ID field to store the type will just makes IDs impractical to use. Let's do it properly.
Why is that impractical? I think it is more practical. Why waste memory on something that is easy to encode in the ID?
I'm not necessarily opposed to splitting this up (Mauro's initial patch series used a separate type field if I remember correctly), but it's not clear to me what the benefits are. Keeping it in a single u32 makes describing links also very easy since you just give it the two objects that are linked and it is immediately clear which object types are linked: no need to either store the types in the link struct or look up each object to find the type.
Quoted 2 lines
Quoted 1 line
+ * All elements on the media graph should have this struct embedded
Quoted 8 lines
Quoted 3 lines
All elements (objects) or only the ones that need an ID ? Or maybe we'll define graph element (object) as an element (object) that has an ID, making some "elements" not elements.
Yes, all objects have an ID. I see no reason to special-case this.
You wrote this at 3 am, so you were probably sleep-deprived when you wrote the second sentence as I can't wrap my head around that one :-)
It's always 3:00am in some time zone, but it wasn't in Seattle ;-)
The question was whether every element is required to have an ID. If some of what we currently call element doesn't need an ID, then we'll have to either modify the quoted documentation, or redefine "element" to only include the elements that have an ID, making the graph objects that don't have an ID not "elements".
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
+ */
include/media/media-entity.h +3
-0+struct media_gobj { +u32 id; +};
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v6 2/8] [media] media: add a common struct to be embed on media graph objects
Em Tue, 08 Sep 2015 00:49:58 +0300
Laurent Pinchart <[email protected]> escreveu:
Quoted 15 lines
Hi Hans,
Quoted 12 lines · On Friday 21 August 2015 10:07:36 Hans Verkuil wrote:
Quoted 10 lines · Laurent Pinchart
include/media/media-entity.h line 34
Quoted 4 lines · On Wednesday 19 August 2015 08:01:49 Mauro Carvalho Chehab wrote:
include/media/media-entity.h +4
-0+/* Enums used internally at the media controller to represent graphs */ + +/** +* enum media_gobj_type - type of a graph element Let's try to standardize the vocabulary, should it be called graph object or graph element ? In the first case let's document it as graph object. In the second case it would be more consistent to refer to it as enum
media_gelem_type(and structmedia_gelembelow).
Quoted 3 lines
Quoted 1 line
For what it is worth, I prefer the term graph object.
So do I.
At v7 we removed the term "elements" in favor of "objects", as proposed by Hans.
Quoted 50 lines
Quoted 11 lines
Quoted 11 lines
include/media/media-entity.h
Quoted 11 lines
+ *
+ */include/media/media-entity.h +8
-0+enum media_gobj_type { +/* FIXME: add the types here, as we embed media_gobj */ +MEDIA_GRAPH_NONE +}; + +#define MEDIA_BITS_PER_TYPE 8 +#define MEDIA_BITS_PER_LOCAL_ID (32 - MEDIA_BITS_PER_TYPE) +#define MEDIA_LOCAL_ID_MASK GENMASK(MEDIA_BITS_PER_LOCAL_ID - 1,0)
Quoted 29 lines
Quoted 7 lines
Quoted 7 lines
include/media/media-entity.h +7
-0+ +/* Structs to represent the objects that belong to a media graph */ + +/** +* struct media_gobj - Define a graph object. +* +* @id: Non-zero object ID identifier. The ID should be unique Quoted 8 lines
Quoted 4 lines
+ * inside a
media_device, as it is composed by
+ *MEDIA_BITS_PER_TYPEto store the type plus
+ *MEDIA_BITS_PER_LOCAL_IDto store a per-type ID
+ * (called as "local ID").I'd very much prefer using a single ID range and adding a type field. Abusing bits of the ID field to store the type will just makes IDs impractical to use. Let's do it properly.
Why is that impractical? I think it is more practical. Why waste memory on something that is easy to encode in the ID?
I'm not necessarily opposed to splitting this up (Mauro's initial patch series used a separate type field if I remember correctly), but it's not clear to me what the benefits are. Keeping it in a single u32 makes describing links also very easy since you just give it the two objects that are linked and it is immediately clear which object types are linked: no need to either store the types in the link struct or look up each object to find the type.
Quoted 2 lines
Quoted 1 line
+ * All elements on the media graph should have this struct embedded
Quoted 8 lines
Quoted 3 lines
All elements (objects) or only the ones that need an ID ? Or maybe we'll define graph element (object) as an element (object) that has an ID, making some "elements" not elements.
Yes, all objects have an ID. I see no reason to special-case this.
You wrote this at 3 am, so you were probably sleep-deprived when you wrote the second sentence as I can't wrap my head around that one :-)
Quoted 7 lines
It's always 3:00am in some time zone, but it wasn't in Seattle ;-)
The question was whether every element is required to have an ID. If some of what we currently call element doesn't need an ID, then we'll have to either modify the quoted documentation, or redefine "element" to only include the elements that have an ID, making the graph objects that don't have an ID not "elements".
Sorry but I read the above 3 or 4 times, but I failed to understand what you're meaning.
There's one good reason for all objects to have an ID: userspace should be able to detect if a graph object was removed.
I mean, let's suppose that the topology_version has changed, because some links were removed and others added, among other changes.
If all objects have an object ID, it is easy (and quick, because all it needs to do is to compare a u32 integer) for userspace to compare the previously retrieved topology with the new one and check what objects were dropped/added by checking the object ID.
Regards,
Mauro
Re: [PATCH v6 2/8] [media] media: add a common struct to be embed on media graph objects
In reply to Laurent PinchartEm Fri, 21 Aug 2015 04:02:57 +0300
Laurent Pinchart <[email protected]> escreveu:
Quoted 21 lines
Hi Mauro,
Thank you for the patch.
Quoted 16 lines · On Wednesday 19 August 2015 08:01:49 Mauro Carvalho Chehab wrote:
Due to the MC API proposed changes, we'll need to have an unique object ID for all graph objects, and have some shared fields that will be common on all media graph objects.
Right now, the only common object is the object ID, but other fields will be added later on.
Signed-off-by Mauro Carvalho Chehab <[email protected]>drivers/media/media-entity.c +0
-0@@ -27,6 +27,38 @@#include <media/media-device.h>
Quoted 12 lines
drivers/media/media-entity.c line 40
Quoted 12 lines
drivers/media/media-entity.c +11
-0/** +* media_gobj_init - Initialize a graph object +* +* @mdev: Pointer to the media_device that contains the object +* @type: Type of the object +* @gobj: Pointer to the object +* +* This routine initializes the embedded struct media_gobj inside a +* media graph object. It is called automatically if media_*_create() +* calls are used. However, if the object (entity, link, pad, interface) +* is embedded on some other object, this function should be called before +* registering the object at the media controller.
Actually, the comment here is a little bit outdated, from the time I was adding a kref inside the graph_obj. That's by the way one of the problems with patches that suffer lots of transforms: comments may need to be adjusted to reflect what changed, but tracking such changes is harder.
The comment above should be, instead:
* This routine initializes the embedded struct media_gobj inside a
* media graph object. It is called automatically at media_*_create()
* and at media_entity_register().
Quoted 3 lines
Allowing both dynamic allocation and embedding will create a more complex API with more opportunities for drivers to get it wrong. I'd like to try and standardize the expected behaviour.
Let's discuss dynamic allocation when we come with the patches. For now, if media_obj_init is not called, objects won't have an unique ID and will cause an OOPS if debug is enabled, with is easily tracked.
Quoted 14 lines
drivers/media/media-entity.c line 50
Quoted 11 lines
drivers/media/media-entity.c +10
-0+*/ +void media_gobj_init (struct media_device *mdev, +enum media_gobj_type type, +struct media_gobj *gobj) +{ +/* For now, nothing to do */ +} + +/** +* media_gobj_remove - Stop using a graph object on a media device Is this function supposed to be the counterpart of
media_gobj_init? If so it should be calledmedia_gobj_cleanupinstead.
*_cleanup doesn't mean anything for me. The usual Kernel way is to use either *_init and *_remove or *_register/*_remove for a kernel "object" creation/removal.
If you prefer, I could rename the first function to media_gobj_register.
Quoted 6 lines
drivers/media/media-entity.c line 52
Quoted 3 lines
drivers/media/media-entity.c +2
-0+* +* @graph_obj: Pointer to the object The parameter is called gobj. Could you compile the kerneldoc to ensure that such typos get caught ?
I will fix at a next version and compile kerneldoc.
Quoted 21 lines
Quoted 21 lines
drivers/media/media-entity.c +9
-0+* +* This should be called at media_device_unregister_*() routines +*/ +void media_gobj_remove (struct media_gobj *gobj) +{ +/* For now, nothing to do */ +} + +/** * media_entity_init - Initialize a media entity * * @num_pads: Total number of sink and source pads. include/media/media-entity.h +0
-0@@ -28,6 +28,39 @@#include <linux/list.h> #include <linux/media.h>
Quoted 9 lines
include/media/media-entity.h line 34
Quoted 4 lines
include/media/media-entity.h +4
-0+/* Enums used internally at the media controller to represent graphs */ + +/** +* enum media_gobj_type - type of a graph element Let's try to standardize the vocabulary, should it be called graph object or graph element ? In the first case let's document it as graph object. In the second case it would be more consistent to refer to it as enum
media_gelem_type(and structmedia_gelembelow).
graph object. Thanks for noticing it. I'll fix.
Quoted 18 lines
Quoted 18 lines
include/media/media-entity.h +17
-0+* +*/ +enum media_gobj_type { +/* FIXME: add the types here, as we embed media_gobj */ +MEDIA_GRAPH_NONE +}; + +#define MEDIA_BITS_PER_TYPE 8 +#define MEDIA_BITS_PER_LOCAL_ID (32 - MEDIA_BITS_PER_TYPE) +#define MEDIA_LOCAL_ID_MASK GENMASK(MEDIA_BITS_PER_LOCAL_ID - 1, 0) + +/* Structs to represent the objects that belong to a media graph */ + +/** +* struct media_gobj - Define a graph object. +* +* @id: Non-zero object ID identifier. The ID should be unique
Quoted 8 lines
include/media/media-entity.h line 55
Quoted 4 lines
include/media/media-entity.h +4
-0+* inside a media_device, as it is composed by +* MEDIA_BITS_PER_TYPE to store the type plus +* MEDIA_BITS_PER_LOCAL_ID to store a per-type ID +* (called as "local ID"). I'd very much prefer using a single ID range and adding a type field. Abusing bits of the ID field to store the type will just makes IDs impractical to use. Let's do it properly.
This came actually from the feedback I got on the first RFC, but it is not possible to use a singe ID range. We can, of course have a separate type, but we need at least two ID ranges.
Otherwise, both Kernelspace and userspace will break.
At least on my tests, the media-ctl implementation is very sensitive to the way the things are currently implemented on Kernel, and even small changes like reporting a backlink or changing the initial object ID to 0 causes it to crash or fail. I suspect that other userspace apps could be even worse.
Also, as I pointed before, the graph traversal algorithm wants that the entity number to be below 64 (MEDIA_ENTITY_ENUM_MAX_ID) and similar mechanisms inside drivers at have even lower constraints for the entity range: no entity can have an ID bigger than 32.
While removing such restrictions at Kernespace is doable, this is out of the scope of this work, and would require changes/testing on hardware that could otherwise work forever keeping the entity range below 32.
That means, in practice, that the first driver that will use dynamic entity addition and removal and need to call the graph_traversal routines at the MC core will have to come up with a different graph traversal algorithm.
So, the question is either if we'll have 2 ranges (one for entities and another one for the other types) or one range per type.
On the first case, we'll be using something like:
ID range from 0x000000000000 to 0x7fffffffffff - entities ID range from 0x800000000000 to 0xffffffffffff - other elements
And split that "global_id" field into two separate fields, as I proposed on my initial patch series:
struct media_gobj {
u32 id;
enum media_gobj_type type;
}While I'm ok with that, it has some drawbacks:
1) if we remove the concept of type+id together, the IDs on userspace will not be "human-friendly", as Sakari requested on his feedback (or it would require some messy hacks).
With the current proposal, if one would like to change something at a pad, instead of using an object ID like:
0x010000000004 It could, instead, use: pad#4
2) What would be the name of the var that would carry on the non-entities ID? I guess the internal API namespace will be a little messier. Should we call it:
mdev.entity_id
mdev.non_entity_id
Or do you have another suggestion for the namespace thing?
3) At debug/tracing logs, it is easier for humans to identify something called "pad#4" than 0x010000000004.
So, at least while we're debugging the patches, I'll keep the ranges separate.
If we decide to do it otherwise, I'll add a patch near the end of the MC next generation patches to change the range ID to whatever gets decided.
Quoted 6 lines
include/media/media-entity.h line 57
Quoted 2 lines
include/media/media-entity.h +1
-0+* All elements on the media graph should have this struct embedded All elements (objects) or only the ones that need an ID ? Or maybe we'll define graph element (object) as an element (object) that has an ID, making some "elements" not elements.
The idea is to have the common struct embedded on all objects, containing the object type, and other common data.
A common struct is very useful for debugging purposes, for notification purposes, etc, as from the object struct is possible to go to the main object. It will also be important when we'll need dynamic support.
All objects need a type. If we split the ID, we might move the ID out of the struct if we ever need an ID-less object, but, I think that an ID-less object is a terrible idea, as it makes a way harder to track the object lifecycle when debugging the code, and objects will then be only referenced internally via pointers.
See, with an object ID for the links, any debug messages can contain the ID, like:
media_gobj_init: id 0x02000002 link#2: 'Xceive XC5000' pad#4 ==> 'Auvitek AU8522 QAM/8VSB Frontend' pad#7
If I need, for example, to check if the ioctl's are properly reporting such link to userspace, all I would need to do is to print the link "name":
link#2
as this is a good enough reference for the object (and yes, I had do do something exactly like that yesterday).
With a combined id+type, there's no penalty of having an ID for all objects. If we split into id + type, we'll "waste" just 4 bytes, with seems a low price to pay to avoid the waste of time when debugging the object lifecycle.
Quoted 38 lines
Quoted 38 lines
include/media/media-entity.h +26
-0+*/ +struct media_gobj { +u32 id; +}; + +struct media_pipeline { };@@ -118,6 +151,26 @@ static inline u32 media_entity_id(struct media_entity *entity) return entity->id; } +static inline enum media_gobj_type media_type (struct media_gobj *gobj) +{ +return gobj->id >>MEDIA_BITS_PER_LOCAL_ID ; +} + +static inline u32 media_localid (struct media_gobj *gobj) +{ +return gobj->id &MEDIA_LOCAL_ID_MASK ; +} + +static inline u32 media_gobj_gen_id (enum media_gobj_type type,u32 local_id) +{ +u32 id; + + id = type <<MEDIA_BITS_PER_LOCAL_ID ; + id |= local_id &MEDIA_LOCAL_ID_MASK ; + +return id; +} +#define MEDIA_ENTITY_ENUM_MAX_DEPTH 16#define MEDIA_ENTITY_ENUM_MAX_ID 64
Quoted 8 lines
include/media/media-entity.h struct media_entity_graph { · line 188
Quoted 6 lines
include/media/media-entity.h +2
-0@@ -131,6 +184,14 @@ struct media_entity_graph {int top; }; +#define gobj_to_entity (gobj) \ + container_of(gobj, struct media_entity, graph_obj)For consistency reason would this be called
media_gobj_to_entity?
I would avoid having a big name for those containers macros.
Also, the usual Kernel practice is to use exactly the same type of declaration like above:
#define <object>_to_<object>(foo) \ container_of(foo, ...)
Quoted 2 lines
I would
also turn it into an inline function to ensure type checking.
container_of() already provides type checking. So, I don't see any gain of inlining it.
Quoted 11 lines
Quoted 10 lines
include/media/media-entity.h +6
-0+ +void media_gobj_init (struct media_device *mdev, +enum media_gobj_type type, +struct media_gobj *gobj); +void media_gobj_remove (struct media_gobj *gobj); +int media_entity_init (struct media_entity *entity,u16 num_pads,struct media_pad *pads);void media_entity_cleanup (struct media_entity *entity);
PATCH v6 3/8 media: use media_gobj inside entities
In reply to Mauro Carvalho ChehabAs entities are graph elements, let's embed media_gobj on it. That ensures an unique ID for entities that can be global along the entire media controller.
For now, we'll keep the already existing entity ID. Such field need to be dropped at some point, but for now, let's not do this, to avoid needing to review all drivers and the userspace apps.
drivers/media/media-device.c +3 -5
@@ -379,7 +379,6 @@ int __must_check __media_device_register(struct media_device *mdev,if (WARN_ON (mdev->dev ==NULL || mdev->model[0 ] ==0 ))return -EINVAL ; - mdev->entity_id =1 ;INIT_LIST_HEAD (&mdev->entities);spin_lock_init (&mdev->lock);mutex_init (&mdev->graph_mutex);
@@ -433,10 +432,8 @@ int __must_check media_device_register_entity(struct media_device *mdev, entity->parent = mdev;spin_lock (&mdev->lock); -if (entity->id ==0 ) - entity->id = mdev->entity_id++; -else - mdev->entity_id =max (entity->id +1 , mdev->entity_id); +/* Initialize media_gobj embedded at the entity */ +media_gobj_init (mdev,MEDIA_GRAPH_ENTITY , &entity->graph_obj);list_add_tail (&entity->list, &mdev->entities);spin_unlock (&mdev->lock);
@@ -459,6 +456,7 @@ void media_device_unregister_entity(struct media_entity *entity)return ;spin_lock (&mdev->lock); +media_gobj_remove (&entity->graph_obj);list_del (&entity->list);spin_unlock (&mdev->lock); entity->parent =NULL ;
drivers/media/media-entity.c +6 -1
@@ -43,7 +43,12 @@ void media_gobj_init(struct media_device *mdev, enum media_gobj_type type, struct media_gobj *gobj) { - /* For now, nothing to do */ +/* Create a per-type unique object ID */ +switch (type) { +case MEDIA_GRAPH_ENTITY : + gobj->id =media_gobj_gen_id (type, ++mdev->entity_id); +break ; + } }/**
include/media/media-device.h +2 -1
@@ -41,7 +41,7 @@ struct device;* @bus_info: Unique and stable device location identifier * @hw_revision: Hardware device revision * @driver_version: Device driver version -* @entity_id: ID of the next entity to be registered +* @entity_id: Unique ID used on the last entity registered * @entities: List of registered entities * @lock: Entities list lock * @graph_mutex: Entities graph operation lock
@@ -69,6 +69,7 @@ struct media_device {u32 driver_version;u32 entity_id; +struct list_head entities;/* Protects the entities list */
include/media/media-entity.h +4 -5
@@ -33,10 +33,10 @@/** * enum media_gobj_type - type of a graph element * +* @MEDIA_GRAPH_ENTITY: Identify a media entity */ enum media_gobj_type { -/* FIXME: add the types here, as we embed media_gobj */ -MEDIA_GRAPH_NONE +MEDIA_GRAPH_ENTITY , };#define MEDIA_BITS_PER_TYPE 8
@@ -94,10 +94,9 @@ struct media_entity_operations { };struct media_entity { +struct media_gobj graph_obj;struct list_head list;struct media_device *parent;/* Media device this entity belongs to*/ -u32 id;/* Entity ID, unique in the parent media -* device context */ const char *name;/* Entity name */ u32 type;/* Entity type (MEDIA_ENT_T_*) */ u32 revision;/* Entity revision, driver specific */
@@ -148,7 +147,7 @@ static inline u32 media_entity_subtype(struct media_entity *entity)static inline u32 media_entity_id (struct media_entity *entity) { -return entity->id; +return entity->graph_obj.id; }static inline enum media_gobj_type media_type (struct media_gobj *gobj)
Signature · 1 line
2.4.3
Laurent Pinchart
maintainerRe: [PATCH v6 3/8] [media] media: use media_gobj inside entities
Hi Mauro,
Thank you for the patch.
Quoted 26 lines · On Wednesday 19 August 2015 08:01:50 Mauro Carvalho Chehab wrote:
As entities are graph elements, let's embed
media_gobjon it. That ensures an unique ID for entities that can be global along the entire media controller.For now, we'll keep the already existing entity ID. Such field need to be dropped at some point, but for now, let's not do this, to avoid needing to review all drivers and the userspace apps.
Signed-off-by Mauro Carvalho Chehab <[email protected]>Acked-by Hans Verkuil <[email protected]>Signed-off-by Mauro Carvalho Chehab <[email protected]>drivers/media/media-device.c +0
-1@@ -379,7 +379,6 @@ int __must_check __media_device_register(struct media_device *mdev, if (WARN_ON(mdev->dev == NULL || mdev->model[0] == 0)) return -EINVAL; - mdev->entity_id =1 ;INIT_LIST_HEAD (&mdev->entities);spin_lock_init (&mdev->lock);mutex_init (&mdev->graph_mutex);
drivers/media/media-device.c int __must_check media_device_register_entity(struct · line 436
Quoted 9 lines
drivers/media/media-device.c +2
-4@@ -433,10 +432,8 @@ int __must_check media_device_register_entity(struct media_device *mdev, entity->parent = mdev;spin_lock (&mdev->lock); -if (entity->id ==0 ) - entity->id = mdev->entity_id++; -else - mdev->entity_id =max (entity->id +1 , mdev->entity_id); +/* Initialize media_gobj embedded at the entity */ +media_gobj_init (mdev,MEDIA_GRAPH_ENTITY , &entity->graph_obj);
Graph object initialization should be moved to media_entity_init() to keep initialization separate from registration.
Quoted 55 lines
drivers/media/media-device.c +1
-0list_add_tail (&entity->list, &mdev->entities);spin_unlock (&mdev->lock);@@ -459,6 +456,7 @@ void media_device_unregister_entity(struct media_entity *entity) return;spin_lock (&mdev->lock); +media_gobj_remove (&entity->graph_obj);list_del (&entity->list);spin_unlock (&mdev->lock); entity->parent =NULL ;drivers/media/media-entity.c +6
-1@@ -43,7 +43,12 @@ void media_gobj_init(struct media_device *mdev, enum media_gobj_type type, struct media_gobj *gobj) { - /* For now, nothing to do */ +/* Create a per-type unique object ID */ +switch (type) { +case MEDIA_GRAPH_ENTITY : + gobj->id =media_gobj_gen_id (type, ++mdev->entity_id); +break ; + } }/** include/media/media-device.h +2
-1@@ -41,7 +41,7 @@ struct device;* @bus_info: Unique and stable device location identifier * @hw_revision: Hardware device revision * @driver_version: Device driver version -* @entity_id: ID of the next entity to be registered +* @entity_id: Unique ID used on the last entity registered * @entities: List of registered entities * @lock: Entities list lock * @graph_mutex: Entities graph operation lock @@ -69,6 +69,7 @@ struct media_device {u32 driver_version;u32 entity_id; +struct list_head entities;/* Protects the entities list */ include/media/media-entity.h +0
-0
include/media/media-entity.h line 36
Quoted 4 lines
include/media/media-entity.h +1
-0@@ -33,10 +33,10 @@/** * enum media_gobj_type - type of a graph element * +* @MEDIA_GRAPH_ENTITY: Identify a media entity
I think we should explicitly define here what an entity is.
Quoted 30 lines
include/media/media-entity.h +3
-5*/ enum media_gobj_type { -/* FIXME: add the types here, as we embed media_gobj */ -MEDIA_GRAPH_NONE +MEDIA_GRAPH_ENTITY , };#define MEDIA_BITS_PER_TYPE 8@@ -94,10 +94,9 @@ struct media_entity_operations { };struct media_entity { +struct media_gobj graph_obj;struct list_head list;struct media_device *parent;/* Media device this entity belongs to*/ -u32 id;/* Entity ID, unique in the parent media -* device context */ const char *name;/* Entity name */ u32 type;/* Entity type (MEDIA_ENT_T_*) */ u32 revision;/* Entity revision, driver specific */ @@ -148,7 +147,7 @@ static inline u32 media_entity_subtype(struct media_entity *entity)static inline u32 media_entity_id (struct media_entity *entity) { -return entity->id; +return entity->graph_obj.id; }static inline enum
media_gobj_typemedia_type(struct media_gobj *gobj)
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v6 3/8] [media] media: use media_gobj inside entities
Em Fri, 21 Aug 2015 04:10:03 +0300
Laurent Pinchart <[email protected]> escreveu:
Quoted 33 lines
Hi Mauro,
Thank you for the patch.
Quoted 28 lines · On Wednesday 19 August 2015 08:01:50 Mauro Carvalho Chehab wrote:
As entities are graph elements, let's embed
media_gobjon it. That ensures an unique ID for entities that can be global along the entire media controller.For now, we'll keep the already existing entity ID. Such field need to be dropped at some point, but for now, let's not do this, to avoid needing to review all drivers and the userspace apps.
Signed-off-by Mauro Carvalho Chehab <[email protected]>Acked-by Hans Verkuil <[email protected]>Signed-off-by Mauro Carvalho Chehab <[email protected]>drivers/media/media-device.c +0
-1@@ -379,7 +379,6 @@ int __must_check __media_device_register(struct media_device *mdev, if (WARN_ON(mdev->dev == NULL || mdev->model[0] == 0)) return -EINVAL; - mdev->entity_id =1 ;INIT_LIST_HEAD (&mdev->entities);spin_lock_init (&mdev->lock);mutex_init (&mdev->graph_mutex);@@ -433,10 +432,8 @@ int __must_check media_device_register_entity(struct media_device *mdev, entity->parent = mdev;
Quoted 10 lines
drivers/media/media-device.c int __must_check media_device_register_entity(struct media_device *mdev, · line 436
Quoted 7 lines
drivers/media/media-device.c +2
-4spin_lock (&mdev->lock); -if (entity->id ==0 ) - entity->id = mdev->entity_id++; -else - mdev->entity_id =max (entity->id +1 , mdev->entity_id); +/* Initialize media_gobj embedded at the entity */ +media_gobj_init (mdev,MEDIA_GRAPH_ENTITY , &entity->graph_obj);Graph object initialization should be moved to
media_entity_init()to keep initialization separate from registration.
Won't work. I tried. My first RFC patches were doing that.
The problem is that media_entity_init() is currently called too early at the V4L2 drivers, before having mdev assigned.
Also, objects without PADs don't call media_entity_init(). At long term, this function may even disappear, as it only exists today to allocate arrays for pads/links. If we get rid of the pads array, it will make no sense to keep it.
Quoted 49 lines
Quoted 49 lines
drivers/media/media-device.c +1
-0list_add_tail (&entity->list, &mdev->entities);spin_unlock (&mdev->lock);@@ -459,6 +456,7 @@ void media_device_unregister_entity(struct media_entity *entity) return;spin_lock (&mdev->lock); +media_gobj_remove (&entity->graph_obj);list_del (&entity->list);spin_unlock (&mdev->lock); entity->parent =NULL ;drivers/media/media-entity.c +6
-1@@ -43,7 +43,12 @@ void media_gobj_init(struct media_device *mdev, enum media_gobj_type type, struct media_gobj *gobj) { - /* For now, nothing to do */ +/* Create a per-type unique object ID */ +switch (type) { +case MEDIA_GRAPH_ENTITY : + gobj->id =media_gobj_gen_id (type, ++mdev->entity_id); +break ; + } }/** include/media/media-device.h +2
-1@@ -41,7 +41,7 @@ struct device;* @bus_info: Unique and stable device location identifier * @hw_revision: Hardware device revision * @driver_version: Device driver version -* @entity_id: ID of the next entity to be registered +* @entity_id: Unique ID used on the last entity registered * @entities: List of registered entities * @lock: Entities list lock * @graph_mutex: Entities graph operation lock @@ -69,6 +69,7 @@ struct media_device {u32 driver_version;u32 entity_id; +struct list_head entities;
Quoted 12 lines
include/media/media-entity.h line 36
Quoted 10 lines
include/media/media-device.h +0
-0/* Protects the entities list */ include/media/media-entity.h +1
-0@@ -33,10 +33,10 @@/** * enum media_gobj_type - type of a graph element * +* @MEDIA_GRAPH_ENTITY: Identify a media entity I think we should explicitly define here what an entity is.
I'm happy to add a new text here if you have a better idea.
Anyway, for now, I'm more concerned on getting things done than to spend lots of time with the comments. As pointed on patch 1/8, while we're changing a lot the code, those comments tend to become obsolete very quick. The comments there is more like a boilerplate, as, once we finish touching at the core, it makes sense to review the comments at media *.h files, converting all descriptions to kernel-doc-nano format (there are several not using it) and review Documentation/media-framework.txt, adding the missing parts.
Quoted 32 lines
Quoted 31 lines
include/media/media-entity.h +3
-5*/ enum media_gobj_type { -/* FIXME: add the types here, as we embed media_gobj */ -MEDIA_GRAPH_NONE +MEDIA_GRAPH_ENTITY , };#define MEDIA_BITS_PER_TYPE 8@@ -94,10 +94,9 @@ struct media_entity_operations { };struct media_entity { +struct media_gobj graph_obj;struct list_head list;struct media_device *parent;/* Media device this entity belongs to*/ -u32 id;/* Entity ID, unique in the parent media -* device context */ const char *name;/* Entity name */ u32 type;/* Entity type (MEDIA_ENT_T_*) */ u32 revision;/* Entity revision, driver specific */ @@ -148,7 +147,7 @@ static inline u32 media_entity_subtype(struct media_entity *entity)static inline u32 media_entity_id (struct media_entity *entity) { -return entity->id; +return entity->graph_obj.id; }static inline enum
media_gobj_typemedia_type(struct media_gobj *gobj)
Laurent Pinchart
maintainerRe: [PATCH v6 3/8] [media] media: use media_gobj inside entities
Hi Mauro,
Quoted 43 lines · On Friday 21 August 2015 07:09:44 Mauro Carvalho Chehab wrote:
Em Fri, 21 Aug 2015 04:10:03 +0300 Laurent Pinchart escreveu:
Quoted 32 lines · On Wednesday 19 August 2015 08:01:50 Mauro Carvalho Chehab wrote:
Quoted 31 lines
As entities are graph elements, let's embed
media_gobjon it. That ensures an unique ID for entities that can be global along the entire media controller.For now, we'll keep the already existing entity ID. Such field need to be dropped at some point, but for now, let's not do this, to avoid needing to review all drivers and the userspace apps.
Signed-off-by Mauro Carvalho Chehab <[email protected]>Acked-by Hans Verkuil <[email protected]>Signed-off-by Mauro Carvalho Chehab <[email protected]>drivers/media/media-device.c +0
-1@@ -379,7 +379,6 @@ int __must_check __media_device_register(struct media_device *mdev, if (WARN_ON(mdev->dev == NULL || mdev->model[0] == 0)) return -EINVAL; - mdev->entity_id =1 ;INIT_LIST_HEAD (&mdev->entities);spin_lock_init (&mdev->lock);drivers/media/media-device.c +0
-0mutex_init (&mdev->graph_mutex);@@ -433,10 +432,8 @@ int __must_check media_device_register_entity(struct media_device *mdev, entity->parent = mdev;spin_lock (&mdev->lock);Quoted 9 lines
drivers/media/media-device.c int __must_check media_device_register_entity(struct media_device *mdev, · line 436
Quoted 6 lines
drivers/media/media-device.c +2
-4-if (entity->id ==0 ) - entity->id = mdev->entity_id++; -else - mdev->entity_id =max (entity->id +1 , mdev->entity_id); +/* Initialize media_gobj embedded at the entity */ +media_gobj_init (mdev,MEDIA_GRAPH_ENTITY , &entity->graph_obj);Graph object initialization should be moved to
media_entity_init()to keep initialization separate from registration.
Quoted 4 lines
Won't work. I tried. My first RFC patches were doing that.
The problem is that
media_entity_init()is currently called too early at the V4L2 drivers, before having mdev assigned.
That looks like a problem that should be fixed in the drivers then. The initialization of media devices and entities hasn't been thought of correctly, let's not carry mistakes forward.
Quoted 4 lines
Also, objects without PADs don't call
media_entity_init(). At long term, this function may even disappear, as it only exists today to allocate arrays for pads/links. If we get rid of the pads array, it will make no sense to keep it.
I wouldn't do that, as if we later add a field to media_entity that requires an initialization function to be called we would need to go and patch all the code that instantiates media_entity to add init calls. I'd prefer keeping the media_entity_init function even if all it does is call media_gobj_init.
Quoted 65 lines
Quoted 50 lines
Quoted 50 lines
drivers/media/media-device.c +1
-0list_add_tail (&entity->list, &mdev->entities);spin_unlock (&mdev->lock);@@ -459,6 +456,7 @@ void media_device_unregister_entity(struct media_entity *entity) return;spin_lock (&mdev->lock); +media_gobj_remove (&entity->graph_obj);list_del (&entity->list);spin_unlock (&mdev->lock);drivers/media/media-device.c +0
-0entity->parent =NULL ;drivers/media/media-entity.c +6
-1@@ -43,7 +43,12 @@ void media_gobj_init(struct media_device *mdev, enum media_gobj_type type, struct media_gobj *gobj) { - /* For now, nothing to do */ +/* Create a per-type unique object ID */ +switch (type) { +case MEDIA_GRAPH_ENTITY : + gobj->id =media_gobj_gen_id (type, ++mdev->entity_id); +break ; + } }/** include/media/media-device.h +2
-1@@ -41,7 +41,7 @@ struct device;* @bus_info: Unique and stable device location identifier * @hw_revision: Hardware device revision * @driver_version: Device driver version -* @entity_id: ID of the next entity to be registered +* @entity_id: Unique ID used on the last entity registered * @entities: List of registered entities * @lock: Entities list lock * @graph_mutex: Entities graph operation lock @@ -69,6 +69,7 @@ struct media_device {u32 driver_version;u32 entity_id; +struct list_head entities;Quoted 12 lines
include/media/media-entity.h line 36
Quoted 10 lines
include/media/media-device.h +0
-0/* Protects the entities list */ include/media/media-entity.h +1
-0@@ -33,10 +33,10 @@/** * enum media_gobj_type - type of a graph element * +* @MEDIA_GRAPH_ENTITY: Identify a media entity I think we should explicitly define here what an entity is.
I'm happy to add a new text here if you have a better idea.
Quoted 8 lines
Anyway, for now, I'm more concerned on getting things done than to spend lots of time with the comments. As pointed on patch 1/8, while we're changing a lot the code, those comments tend to become obsolete very quick. The comments there is more like a boilerplate, as, once we finish touching at the core, it makes sense to review the comments at media *.h files, converting all descriptions to kernel-doc-nano format (there are several not using it) and review
Documentation/media-framework.txt, adding the missing parts.
Yes, we'll need to update Documentation/media-framework.txt. It doesn't have to be done right now, but should be ready by the time patches get merged. And from my experience, even though writing documentation feels like wasting time when you develop a patch series such as this one, it gets even more painful if you delay it.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
include/media/media-entity.h +1
-2*/ enum media_gobj_type { -/* FIXME: add the types here, as we embed media_gobj */ -MEDIA_GRAPH_NONE +MEDIA_GRAPH_ENTITY , };
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v6 3/8] [media] media: use media_gobj inside entities
Em Fri, 21 Aug 2015 20:51:10 +0300
Laurent Pinchart <[email protected]> escreveu:
Quoted 46 lines
Hi Mauro,
Quoted 43 lines · On Friday 21 August 2015 07:09:44 Mauro Carvalho Chehab wrote:
Em Fri, 21 Aug 2015 04:10:03 +0300 Laurent Pinchart escreveu:
Quoted 41 lines · On Wednesday 19 August 2015 08:01:50 Mauro Carvalho Chehab wrote:
Quoted 27 lines
As entities are graph elements, let's embed
media_gobjon it. That ensures an unique ID for entities that can be global along the entire media controller.For now, we'll keep the already existing entity ID. Such field need to be dropped at some point, but for now, let's not do this, to avoid needing to review all drivers and the userspace apps.
Signed-off-by Mauro Carvalho Chehab <[email protected]>Acked-by Hans Verkuil <[email protected]>Signed-off-by Mauro Carvalho Chehab <[email protected]>drivers/media/media-device.c +0
-1@@ -379,7 +379,6 @@ int __must_check __media_device_register(struct media_device *mdev, if (WARN_ON(mdev->dev == NULL || mdev->model[0] == 0)) return -EINVAL; - mdev->entity_id =1 ;INIT_LIST_HEAD (&mdev->entities);spin_lock_init (&mdev->lock);drivers/media/media-device.c +0
-0mutex_init (&mdev->graph_mutex);drivers/media/media-device.c int __must_check media_device_register_entity(struct · line 437
Quoted 10 lines
drivers/media/media-device.c +2
-4@@ -433,10 +432,8 @@ int __must_check media_device_register_entity(struct media_device *mdev, entity->parent = mdev;spin_lock (&mdev->lock); -if (entity->id ==0 ) - entity->id = mdev->entity_id++; -else - mdev->entity_id =max (entity->id +1 , mdev->entity_id); +/* Initialize media_gobj embedded at the entity */ +media_gobj_init (mdev,MEDIA_GRAPH_ENTITY , &entity->graph_obj);Graph object initialization should be moved to
media_entity_init()to keep initialization separate from registration.
Quoted 8 lines
Quoted 4 lines
Won't work. I tried. My first RFC patches were doing that.
The problem is that
media_entity_init()is currently called too early at the V4L2 drivers, before having mdev assigned.That looks like a problem that should be fixed in the drivers then. The initialization of media devices and entities hasn't been thought of correctly, let's not carry mistakes forward.
In this particular case, calling media_gobj_init() during media_entity_register() won't cause any troubles, and moving it latter to media_entity_init() is a two lines patch, once drivers got fixed by the drivers maintainers.
Quoted 9 lines
Quoted 4 lines
Also, objects without PADs don't call
media_entity_init(). At long term, this function may even disappear, as it only exists today to allocate arrays for pads/links. If we get rid of the pads array, it will make no sense to keep it.I wouldn't do that, as if we later add a field to
media_entitythat requires an initialization function to be called we would need to go and patch all the code that instantiatesmedia_entityto add init calls. I'd prefer keeping themedia_entity_initfunction even if all it does is callmedia_gobj_init.
OK.
Quoted 75 lines
Quoted 66 lines
Quoted 51 lines
Quoted 51 lines
drivers/media/media-device.c +1
-0list_add_tail (&entity->list, &mdev->entities);spin_unlock (&mdev->lock);@@ -459,6 +456,7 @@ void media_device_unregister_entity(struct media_entity *entity) return;spin_lock (&mdev->lock); +media_gobj_remove (&entity->graph_obj);list_del (&entity->list);spin_unlock (&mdev->lock);drivers/media/media-device.c +0
-0entity->parent =NULL ;drivers/media/media-entity.c +6
-1@@ -43,7 +43,12 @@ void media_gobj_init(struct media_device *mdev, enum media_gobj_type type, struct media_gobj *gobj) { - /* For now, nothing to do */ +/* Create a per-type unique object ID */ +switch (type) { +case MEDIA_GRAPH_ENTITY : + gobj->id =media_gobj_gen_id (type, ++mdev->entity_id); +break ; + } }/** include/media/media-device.h +2
-1@@ -41,7 +41,7 @@ struct device;* @bus_info: Unique and stable device location identifier * @hw_revision: Hardware device revision * @driver_version: Device driver version -* @entity_id: ID of the next entity to be registered +* @entity_id: Unique ID used on the last entity registered * @entities: List of registered entities * @lock: Entities list lock * @graph_mutex: Entities graph operation lock @@ -69,6 +69,7 @@ struct media_device {u32 driver_version;u32 entity_id; +struct list_head entities;Quoted 12 lines
include/media/media-entity.h line 36
Quoted 10 lines
include/media/media-device.h +0
-0/* Protects the entities list */ include/media/media-entity.h +1
-0@@ -33,10 +33,10 @@/** * enum media_gobj_type - type of a graph element * +* @MEDIA_GRAPH_ENTITY: Identify a media entity I think we should explicitly define here what an entity is.
I'm happy to add a new text here if you have a better idea.
Quoted 8 lines
Anyway, for now, I'm more concerned on getting things done than to spend lots of time with the comments. As pointed on patch 1/8, while we're changing a lot the code, those comments tend to become obsolete very quick. The comments there is more like a boilerplate, as, once we finish touching at the core, it makes sense to review the comments at media *.h files, converting all descriptions to kernel-doc-nano format (there are several not using it) and review
Documentation/media-framework.txt, adding the missing parts.
Quoted 2 lines
Yes, we'll need to update
Documentation/media-framework.txt. It doesn't have to be done right now, but should be ready by the time patches get merged.
Ok.
Quoted 12 lines
And
from my experience, even though writing documentation feels like wasting time when you develop a patch series such as this one, it gets even more painful if you delay it.Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
include/media/media-entity.h +1
-2*/ enum media_gobj_type { -/* FIXME: add the types here, as we embed media_gobj */ -MEDIA_GRAPH_NONE +MEDIA_GRAPH_ENTITY , };
Laurent Pinchart
maintainerRe: [PATCH v6 3/8] [media] media: use media_gobj inside entities
Hi Mauro,
Quoted 53 lines · On Friday 21 August 2015 18:01:31 Mauro Carvalho Chehab wrote:
Em Fri, 21 Aug 2015 20:51:10 +0300 Laurent Pinchart escreveu:
Quoted 52 lines · On Friday 21 August 2015 07:09:44 Mauro Carvalho Chehab wrote:
Quoted 50 lines
Em Fri, 21 Aug 2015 04:10:03 +0300 Laurent Pinchart escreveu:
Quoted 35 lines · On Wednesday 19 August 2015 08:01:50 Mauro Carvalho Chehab wrote:
Quoted 34 lines
As entities are graph elements, let's embed
media_gobjon it. That ensures an unique ID for entities that can be global along the entire media controller.For now, we'll keep the already existing entity ID. Such field need to be dropped at some point, but for now, let's not do this, to avoid needing to review all drivers and the userspace apps.
Signed-off-by Mauro Carvalho Chehab <[email protected]>Acked-by Hans Verkuil <[email protected]>Signed-off-by Mauro Carvalho Chehab <[email protected]>drivers/media/media-device.c +0
-1@@ -379,7 +379,6 @@ int __must_check __media_device_register(struct media_device *mdev, if (WARN_ON(mdev->dev == NULL || mdev->model[0] == 0)) return -EINVAL; - mdev->entity_id =1 ;INIT_LIST_HEAD (&mdev->entities);spin_lock_init (&mdev->lock);drivers/media/media-device.c +0
-0mutex_init (&mdev->graph_mutex);@@ -433,10 +432,8 @@ int __must_check media_device_register_entity(struct media_device *mdev, entity->parent = mdev;spin_lock (&mdev->lock);Quoted 9 lines
drivers/media/media-device.c int __must_check media_device_register_entity(struct media_device *mdev, · line 436
Quoted 6 lines
drivers/media/media-device.c +2
-4-if (entity->id ==0 ) - entity->id = mdev->entity_id++; -else - mdev->entity_id =max (entity->id +1 , mdev->entity_id); +/* Initialize media_gobj embedded at the entity */ +media_gobj_init (mdev,MEDIA_GRAPH_ENTITY , &entity->graph_obj);Graph object initialization should be moved to
media_entity_init()to keep initialization separate from registration.Won't work. I tried. My first RFC patches were doing that.
The problem is that
media_entity_init()is currently called too early at the V4L2 drivers, before having mdev assigned.
Quoted 8 lines
Quoted 3 lines
That looks like a problem that should be fixed in the drivers then. The initialization of media devices and entities hasn't been thought of correctly, let's not carry mistakes forward.
In this particular case, calling
media_gobj_init()duringmedia_entity_register()won't cause any troubles, and moving it latter tomedia_entity_init()is a two lines patch, once drivers got fixed by the drivers maintainers.
It's the "once drivers got fixed by the drivers maintainers" that worries me. We all know it unfortunately doesn't happen by itself, and I believe it will become more and more difficult as time goes by and more drivers use the MC framework. We're trying to refactor, clean up and extend MC, both in-kernel and towards userspace, to correct design and implementation mistakes. I'm worried that we'll make different but similarly painful mistakes if we don't take a bit of time to do things properly now. And while it will require a couple more patches, I don't think we're looking at months of work either.
It might be that assigning an ID to objects can only be done at at registration time, especially for standalone subdev drivers (I'm thinking about the I2C camera sensors in particular). Still, calling media_gobj_init() in media_device_register_entity() doesn't sound right. Maybe the solution is to use media_gobj_init() for init-time initialization, and creating a media_gobj_assign_id() (or similarly-named) function to call at registration time. What I'd really like to see is clear explicit rules regarding how init/cleanup and register/unregister interact and how they should be used by drivers. The current mess is partly caused by not having thought this out properly to start with.
I also have a feeling that we'll realize changes are required when implementing support for dynamic changes.
Quoted 16 lines
Quoted 10 lines
Quoted 4 lines
Also, objects without PADs don't call
media_entity_init(). At long term, this function may even disappear, as it only exists today to allocate arrays for pads/links. If we get rid of the pads array, it will make no sense to keep it.I wouldn't do that, as if we later add a field to
media_entitythat requires an initialization function to be called we would need to go and patch all the code that instantiatesmedia_entityto add init calls. I'd prefer keeping themedia_entity_initfunction even if all it does is callmedia_gobj_init.OK.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/media/media-device.c +0
-0list_add_tail (&entity->list, &mdev->entities);spin_unlock (&mdev->lock);
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v6 3/8] [media] media: use media_gobj inside entities
Em Sat, 22 Aug 2015 01:47:37 +0300
Laurent Pinchart <[email protected]> escreveu:
Quoted 74 lines
Hi Mauro,
Quoted 53 lines · On Friday 21 August 2015 18:01:31 Mauro Carvalho Chehab wrote:
Em Fri, 21 Aug 2015 20:51:10 +0300 Laurent Pinchart escreveu:
Quoted 52 lines · On Friday 21 August 2015 07:09:44 Mauro Carvalho Chehab wrote:
Quoted 50 lines
Em Fri, 21 Aug 2015 04:10:03 +0300 Laurent Pinchart escreveu:
Quoted 35 lines · On Wednesday 19 August 2015 08:01:50 Mauro Carvalho Chehab wrote:
Quoted 34 lines
As entities are graph elements, let's embed
media_gobjon it. That ensures an unique ID for entities that can be global along the entire media controller.For now, we'll keep the already existing entity ID. Such field need to be dropped at some point, but for now, let's not do this, to avoid needing to review all drivers and the userspace apps.
Signed-off-by Mauro Carvalho Chehab <[email protected]>Acked-by Hans Verkuil <[email protected]>Signed-off-by Mauro Carvalho Chehab <[email protected]>drivers/media/media-device.c +0
-1@@ -379,7 +379,6 @@ int __must_check __media_device_register(struct media_device *mdev, if (WARN_ON(mdev->dev == NULL || mdev->model[0] == 0)) return -EINVAL; - mdev->entity_id =1 ;INIT_LIST_HEAD (&mdev->entities);spin_lock_init (&mdev->lock);drivers/media/media-device.c +0
-0mutex_init (&mdev->graph_mutex);@@ -433,10 +432,8 @@ int __must_check media_device_register_entity(struct media_device *mdev, entity->parent = mdev;spin_lock (&mdev->lock);Quoted 9 lines
drivers/media/media-device.c int __must_check media_device_register_entity(struct media_device *mdev, · line 436
Quoted 6 lines
drivers/media/media-device.c +2
-4-if (entity->id ==0 ) - entity->id = mdev->entity_id++; -else - mdev->entity_id =max (entity->id +1 , mdev->entity_id); +/* Initialize media_gobj embedded at the entity */ +media_gobj_init (mdev,MEDIA_GRAPH_ENTITY , &entity->graph_obj);Graph object initialization should be moved to
media_entity_init()to keep initialization separate from registration.Won't work. I tried. My first RFC patches were doing that.
The problem is that
media_entity_init()is currently called too early at the V4L2 drivers, before having mdev assigned.Quoted 8 lines
Quoted 3 lines
That looks like a problem that should be fixed in the drivers then. The initialization of media devices and entities hasn't been thought of correctly, let's not carry mistakes forward.
In this particular case, calling
media_gobj_init()duringmedia_entity_register()won't cause any troubles, and moving it latter tomedia_entity_init()is a two lines patch, once drivers got fixed by the drivers maintainers.It's the "once drivers got fixed by the drivers maintainers" that worries me. We all know it unfortunately doesn't happen by itself, and I believe it will become more and more difficult as time goes by and more drivers use the MC framework. We're trying to refactor, clean up and extend MC, both in-kernel and towards userspace, to correct design and implementation mistakes. I'm worried that we'll make different but similarly painful mistakes if we don't take a bit of time to do things properly now. And while it will require a couple more patches, I don't think we're looking at months of work either.
Quoted 10 lines
It might be that assigning an ID to objects can only be done at at registration time, especially for standalone subdev drivers (I'm thinking about the I2C camera sensors in particular). Still, calling
media_gobj_init()inmedia_device_register_entity()doesn't sound right. Maybe the solution is to usemedia_gobj_init()for init-time initialization, and creating amedia_gobj_assign_id()(or similarly-named) function to call at registration time. What I'd really like to see is clear explicit rules regarding how init/cleanup and register/unregister interact and how they should be used by drivers. The current mess is partly caused by not having thought this out properly to start with.
See the latest patch series, as it now has the big picture. What media_gobj_init() is meant to be (and it does) is to register a graph object at the media device. This can only be done if mdev is known. And media_gobj_remove() does the opposite.
Ok, perhaps we can rename it to media_gobj_register() and media_gobj_unregister(), but the right place for it to be called is when the object is ready to be registered, and not before.
Quoted 3 lines
I also have a feeling that we'll realize changes are required when implementing support for dynamic changes.
You're probably right here: we'll likely need to change the drivers for them to create things only when the media_device is known, and splitting entity creation from pads creation.
Quoted 18 lines
Quoted 17 lines
Quoted 11 lines
Quoted 5 lines
Also, objects without PADs don't call
media_entity_init(). At long term, this function may even disappear, as it only exists today to allocate arrays for pads/links. If we get rid of the pads array, it will make no sense to keep it.I wouldn't do that, as if we later add a field to
media_entitythat requires an initialization function to be called we would need to go and patch all the code that instantiatesmedia_entityto add init calls. I'd prefer keeping themedia_entity_initfunction even if all it does is callmedia_gobj_init.OK.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/media/media-device.c +0
-0list_add_tail (&entity->list, &mdev->entities);spin_unlock (&mdev->lock);
PATCH v6 4/8 media: use media_gobj inside pads
In reply to Mauro Carvalho ChehabPADs also need unique object IDs that won't conflict with the entity object IDs.
The pad objects are currently created via media_entity_init() and, once created, never change.
While this will likely change in the future in order to support dynamic changes, for now we'll keep PADs as arrays and initialize the media_gobj embedded structs when registering the entity.
drivers/media/media-device.c +11 -0
@@ -427,6 +427,8 @@ EXPORT_SYMBOL_GPL(media_device_unregister);int __must_check media_device_register_entity (struct media_device *mdev,struct media_entity *entity) { +int i; +/* Warn if we apparently re-register an entity */ WARN_ON (entity->parent !=NULL ); entity->parent = mdev;
@@ -435,6 +437,12 @@ int __must_check media_device_register_entity(struct media_device *mdev,/* Initialize media_gobj embedded at the entity */ media_gobj_init (mdev,MEDIA_GRAPH_ENTITY , &entity->graph_obj);list_add_tail (&entity->list, &mdev->entities); + +/* Initialize objects at the pads */ +for (i =0 ; i < entity->num_pads; i++) +media_gobj_init (mdev,MEDIA_GRAPH_PAD , + &entity->pads[i].graph_obj); +spin_unlock (&mdev->lock);return 0 ;
@@ -450,12 +458,15 @@ EXPORT_SYMBOL_GPL(media_device_register_entity);*/ void media_device_unregister_entity (struct media_entity *entity) { +int i;struct media_device *mdev = entity->parent;if (mdev ==NULL )return ;spin_lock (&mdev->lock); +for (i =0 ; i < entity->num_pads; i++) +media_gobj_remove (&entity->pads[i].graph_obj);media_gobj_remove (&entity->graph_obj);list_del (&entity->list);spin_unlock (&mdev->lock);
drivers/media/media-entity.c +3 -0
@@ -48,6 +48,9 @@ void media_gobj_init(struct media_device *mdev,case MEDIA_GRAPH_ENTITY : gobj->id =media_gobj_gen_id (type, ++mdev->entity_id);break ; +case MEDIA_GRAPH_PAD : + gobj->id =media_gobj_gen_id (type, ++mdev->pad_id); +break ; } }
include/media/media-device.h +2 -0
@@ -42,6 +42,7 @@ struct device;* @hw_revision: Hardware device revision * @driver_version: Device driver version * @entity_id: Unique ID used on the last entity registered +* @pad_id: Unique ID used on the last pad registered * @entities: List of registered entities * @lock: Entities list lock * @graph_mutex: Entities graph operation lock
@@ -69,6 +70,7 @@ struct media_device {u32 driver_version;u32 entity_id; +u32 pad_id;struct list_head entities;
include/media/media-entity.h +3 -0
@@ -34,9 +34,11 @@* enum media_gobj_type - type of a graph element * * @MEDIA_GRAPH_ENTITY: Identify a media entity +* @MEDIA_GRAPH_PAD: Identify a media pad */ enum media_gobj_type {MEDIA_GRAPH_ENTITY , +MEDIA_GRAPH_PAD , };#define MEDIA_BITS_PER_TYPE 8
@@ -72,6 +74,7 @@ struct media_link { };struct media_pad { +struct media_gobj graph_obj;struct media_entity *entity;/* Entity this pad belongs to */ u16 index;/* Pad index in the entity pads array */ unsigned long flags;/* Pad flags (MEDIA_PAD_FL_*) */
Signature · 1 line
2.4.3
PATCH v6 5/8 media: use media_gobj inside links
In reply to Mauro Carvalho ChehabJust like entities and pads, links also need to have unique Object IDs along a given media controller.
So, let's add a media_gobj inside it and initialize the object then a new link is created.
drivers/media/media-device.c +9 -0
@@ -438,6 +438,13 @@ int __must_check media_device_register_entity(struct media_device *mdev,media_gobj_init (mdev,MEDIA_GRAPH_ENTITY , &entity->graph_obj);list_add_tail (&entity->list, &mdev->entities); +/* +* Initialize objects at the links +* in the case where links got created before entity register +*/ +for (i =0 ; i < entity->num_links; i++) +media_gobj_init (mdev,MEDIA_GRAPH_LINK , + &entity->links[i].graph_obj);/* Initialize objects at the pads */ for (i =0 ; i < entity->num_pads; i++) media_gobj_init(mdev, MEDIA_GRAPH_PAD,
@@ -465,6 +472,8 @@ void media_device_unregister_entity(struct media_entity *entity)return ;spin_lock (&mdev->lock); +for (i =0 ; i < entity->num_links; i++) +media_gobj_remove (&entity->links[i].graph_obj);for (i =0 ; i < entity->num_pads; i++)media_gobj_remove (&entity->pads[i].graph_obj);media_gobj_remove (&entity->graph_obj);
drivers/media/media-entity.c +9 -0
@@ -51,6 +51,9 @@ void media_gobj_init(struct media_device *mdev,case MEDIA_GRAPH_PAD : gobj->id =media_gobj_gen_id (type, ++mdev->pad_id);break ; +case MEDIA_GRAPH_LINK : + gobj->id =media_gobj_gen_id (type, ++mdev->link_id); +break ; } }
@@ -491,6 +494,9 @@ media_entity_create_link(struct media_entity *source, u16 source_pad, link->sink = &sink->pads[sink_pad]; link->flags = flags; +/* Initialize graph object embedded at the new link */ +media_gobj_init (source->parent,MEDIA_GRAPH_LINK , &link->graph_obj); +/* Create the backlink. Backlinks are used to help graph traversal and * are not reported to userspace. */
@@ -504,6 +510,9 @@ media_entity_create_link(struct media_entity *source, u16 source_pad, backlink->sink = &sink->pads[sink_pad]; backlink->flags = flags; +/* Initialize graph object embedded at the new link */ +media_gobj_init (sink->parent,MEDIA_GRAPH_LINK , &backlink->graph_obj); + link->reverse = backlink; backlink->reverse = link;
include/media/media-device.h +2 -0
@@ -43,6 +43,7 @@ struct device;* @driver_version: Device driver version * @entity_id: Unique ID used on the last entity registered * @pad_id: Unique ID used on the last pad registered +* @link_id: Unique ID used on the last link registered * @entities: List of registered entities * @lock: Entities list lock * @graph_mutex: Entities graph operation lock
@@ -71,6 +72,7 @@ struct media_device {u32 entity_id;u32 pad_id; +u32 link_id;struct list_head entities;
include/media/media-entity.h +3 -0
@@ -35,10 +35,12 @@* * @MEDIA_GRAPH_ENTITY: Identify a media entity * @MEDIA_GRAPH_PAD: Identify a media pad +* @MEDIA_GRAPH_LINK: Identify a media link */ enum media_gobj_type {MEDIA_GRAPH_ENTITY ,MEDIA_GRAPH_PAD , +MEDIA_GRAPH_LINK , };#define MEDIA_BITS_PER_TYPE 8
@@ -67,6 +69,7 @@ struct media_pipeline { };struct media_link { +struct media_gobj graph_obj;struct media_pad *source;/* Source pad */ struct media_pad *sink;/* Sink pad */ struct media_link *reverse;/* Link in the reverse direction */
Signature · 1 line
2.4.3
Re: [PATCH v6 5/8] [media] media: use media_gobj inside links
Quoted 7 lines · Mauro Carvalho Chehab
Just like entities and pads, links also need to have unique Object IDs along a given media controller.
So, let's add a
media_gobjinside it and initialize the object then a new link is created.Signed-off-by Mauro Carvalho Chehab <[email protected]>
Hmm, my earlier Ack was lost. Here it is again:
Regards,
Hans
Quoted 108 lines
drivers/media/media-device.c +9
-0@@ -438,6 +438,13 @@ int __must_check media_device_register_entity(struct media_device *mdev,media_gobj_init (mdev,MEDIA_GRAPH_ENTITY , &entity->graph_obj);list_add_tail (&entity->list, &mdev->entities); +/* +* Initialize objects at the links +* in the case where links got created before entity register +*/ +for (i =0 ; i < entity->num_links; i++) +media_gobj_init (mdev,MEDIA_GRAPH_LINK , + &entity->links[i].graph_obj);/* Initialize objects at the pads */ for (i =0 ; i < entity->num_pads; i++) media_gobj_init(mdev, MEDIA_GRAPH_PAD,@@ -465,6 +472,8 @@ void media_device_unregister_entity(struct media_entity *entity)return ;spin_lock (&mdev->lock); +for (i =0 ; i < entity->num_links; i++) +media_gobj_remove (&entity->links[i].graph_obj);for (i =0 ; i < entity->num_pads; i++)media_gobj_remove (&entity->pads[i].graph_obj);media_gobj_remove (&entity->graph_obj);drivers/media/media-entity.c +9
-0@@ -51,6 +51,9 @@ void media_gobj_init(struct media_device *mdev,case MEDIA_GRAPH_PAD : gobj->id =media_gobj_gen_id (type, ++mdev->pad_id);break ; +case MEDIA_GRAPH_LINK : + gobj->id =media_gobj_gen_id (type, ++mdev->link_id); +break ; } }@@ -491,6 +494,9 @@ media_entity_create_link(struct media_entity *source, u16 source_pad, link->sink = &sink->pads[sink_pad]; link->flags = flags; +/* Initialize graph object embedded at the new link */ +media_gobj_init (source->parent,MEDIA_GRAPH_LINK , &link->graph_obj); +/* Create the backlink. Backlinks are used to help graph traversal and * are not reported to userspace. */ @@ -504,6 +510,9 @@ media_entity_create_link(struct media_entity *source, u16 source_pad, backlink->sink = &sink->pads[sink_pad]; backlink->flags = flags; +/* Initialize graph object embedded at the new link */ +media_gobj_init (sink->parent,MEDIA_GRAPH_LINK , &backlink->graph_obj); + link->reverse = backlink; backlink->reverse = link;include/media/media-device.h +2
-0@@ -43,6 +43,7 @@ struct device;* @driver_version: Device driver version * @entity_id: Unique ID used on the last entity registered * @pad_id: Unique ID used on the last pad registered +* @link_id: Unique ID used on the last link registered * @entities: List of registered entities * @lock: Entities list lock * @graph_mutex: Entities graph operation lock @@ -71,6 +72,7 @@ struct media_device {u32 entity_id;u32 pad_id; +u32 link_id;struct list_head entities;include/media/media-entity.h +3
-0@@ -35,10 +35,12 @@* * @MEDIA_GRAPH_ENTITY: Identify a media entity * @MEDIA_GRAPH_PAD: Identify a media pad +* @MEDIA_GRAPH_LINK: Identify a media link */ enum media_gobj_type {MEDIA_GRAPH_ENTITY ,MEDIA_GRAPH_PAD , +MEDIA_GRAPH_LINK , };#define MEDIA_BITS_PER_TYPE 8@@ -67,6 +69,7 @@ struct media_pipeline { };struct media_link { +struct media_gobj graph_obj;struct media_pad *source;/* Source pad */ struct media_pad *sink;/* Sink pad */ struct media_link *reverse;/* Link in the reverse direction */
PATCH v6 6/8 media: add messages when media device gets (un)registered
In reply to Mauro Carvalho ChehabWe can only free the media device after being sure that no graph object is used.
In order to help tracking it, let's add debug messages that will print when the media controller gets registered or unregistered.
drivers/media/media-device.c +5 -0
@@ -359,6 +359,7 @@ static DEVICE_ATTR(model, S_IRUGO, show_model, NULL);static void media_device_release (struct media_devnode *mdev) { +dev_dbg (mdev->parent,"Media device released\n" ); }/**
@@ -397,6 +398,8 @@ int __must_check __media_device_register(struct media_device *mdev,return ret; } +dev_dbg (mdev->dev,"Media device registered\n" ); +return 0 ; }EXPORT_SYMBOL_GPL (__media_device_register);
@@ -416,6 +419,8 @@ void media_device_unregister(struct media_device *mdev)device_remove_file (&mdev->devnode.dev, &dev_attr_model);media_devnode_unregister (&mdev->devnode); + +dev_dbg (mdev->dev,"Media device unregistered\n" ); }EXPORT_SYMBOL_GPL (media_device_unregister);
Signature · 1 line
2.4.3
Re: [PATCH v6 6/8] [media] media: add messages when media device gets (un)registered
Quoted 8 lines · Mauro Carvalho Chehab
We can only free the media device after being sure that no graph object is used.
In order to help tracking it, let's add debug messages that will print when the media controller gets registered or unregistered.
Signed-off-by Mauro Carvalho Chehab <[email protected]>
Thanks,
Hans
Quoted 32 lines
drivers/media/media-device.c +5
-0@@ -359,6 +359,7 @@ static DEVICE_ATTR(model, S_IRUGO, show_model, NULL);static void media_device_release (struct media_devnode *mdev) { +dev_dbg (mdev->parent,"Media device released\n" ); }/** @@ -397,6 +398,8 @@ int __must_check __media_device_register(struct media_device *mdev,return ret; } +dev_dbg (mdev->dev,"Media device registered\n" ); +return 0 ; }EXPORT_SYMBOL_GPL (__media_device_register);@@ -416,6 +419,8 @@ void media_device_unregister(struct media_device *mdev)device_remove_file (&mdev->devnode.dev, &dev_attr_model);media_devnode_unregister (&mdev->devnode); + +dev_dbg (mdev->dev,"Media device unregistered\n" ); }EXPORT_SYMBOL_GPL (media_device_unregister);
Laurent Pinchart
maintainerRe: [PATCH v6 6/8] [media] media: add messages when media device gets (un)registered
In reply to Mauro Carvalho ChehabHi Mauro,
Thank you for the patch.
Quoted 2 lines · On Wednesday 19 August 2015 08:01:53 Mauro Carvalho Chehab wrote:
We can only free the media device after being sure that no graph object is used.
media_device_release() is currently broken as it should call back to the driver that has allocated the media_device() structure. I think we should fix that before adding more code on top of the problem.
Quoted 11 lines
In order to help tracking it, let's add debug messages that will print when the media controller gets registered or unregistered.
Signed-off-by Mauro Carvalho Chehab <[email protected]>drivers/media/media-device.c +0
-0
drivers/media/media-device.c static DEVICE_ATTR(model, S_IRUGO, show_model, NULL); · line 362
Quoted 4 lines
drivers/media/media-device.c +1
-0@@ -359,6 +359,7 @@ static DEVICE_ATTR(model, S_IRUGO, show_model, NULL);static void media_device_release (struct media_devnode *mdev) { +dev_dbg (mdev->parent,"Media device released\n" );
As commented on patch 7/8, ftrace is a better candidate for function tracing.
Quoted 20 lines
drivers/media/media-device.c +4
-0}/** @@ -397,6 +398,8 @@ int __must_check __media_device_register(struct media_device *mdev, return ret; } +dev_dbg (mdev->dev,"Media device registered\n" ); +return 0 ; }EXPORT_SYMBOL_GPL (__media_device_register);@@ -416,6 +419,8 @@ void media_device_unregister(struct media_device *mdev)device_remove_file (&mdev->devnode.dev, &dev_attr_model);media_devnode_unregister (&mdev->devnode); + +dev_dbg (mdev->dev,"Media device unregistered\n" ); }EXPORT_SYMBOL_GPL (media_device_unregister);
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v6 6/8] [media] media: add messages when media device gets (un)registered
Em Fri, 21 Aug 2015 04:35:04 +0300
Laurent Pinchart <[email protected]> escreveu:
Quoted 11 lines
Hi Mauro,
Thank you for the patch.
Quoted 2 lines · On Wednesday 19 August 2015 08:01:53 Mauro Carvalho Chehab wrote:
We can only free the media device after being sure that no graph object is used.
media_device_release()is currently broken as it should call back to the driver that has allocated themedia_device()structure. I think we should fix that before adding more code on top of the problem.
Either that or move all allocations to happen via some MC function, but this is out of the scope of this patch.
Whatever way we fix it, it is important to know when mdev is supposed to cease to exist, and if this call happens before or after the removal of all objects from the graph.
Quoted 13 lines
Quoted 13 lines
In order to help tracking it, let's add debug messages that will print when the media controller gets registered or unregistered.
Signed-off-by Mauro Carvalho Chehab <[email protected]>drivers/media/media-device.c +0
-0@@ -359,6 +359,7 @@ static DEVICE_ATTR(model, S_IRUGO, show_model, NULL);
Quoted 5 lines
drivers/media/media-device.c static DEVICE_ATTR(model, S_IRUGO, show_model, NULL); · line 362
Quoted 3 lines
drivers/media/media-device.c +1
-0static void media_device_release (struct media_devnode *mdev) { +dev_dbg (mdev->parent,"Media device released\n" );As commented on patch 7/8, ftrace is a better candidate for function tracing.
Again, the problem here is to compare this with OOPs and other debug messages, to see if the release is happening at the proper place.
Ftrace is not meant to be used for OOPS debug, nor it provides data to the console, as it is not designed to be used for that purpose.
Quoted 22 lines
Quoted 21 lines
drivers/media/media-device.c +4
-0}/** @@ -397,6 +398,8 @@ int __must_check __media_device_register(struct media_device *mdev, return ret; } +dev_dbg (mdev->dev,"Media device registered\n" ); +return 0 ; }EXPORT_SYMBOL_GPL (__media_device_register);@@ -416,6 +419,8 @@ void media_device_unregister(struct media_device *mdev)device_remove_file (&mdev->devnode.dev, &dev_attr_model);media_devnode_unregister (&mdev->devnode); + +dev_dbg (mdev->dev,"Media device unregistered\n" ); }EXPORT_SYMBOL_GPL (media_device_unregister);
PATCH v6 7/8 media: add a debug message to warn about gobj creation/removal
In reply to Mauro Carvalho ChehabIt helps to check if the media controller is doing the right thing with the object creation and removal.
No extra code/data will be produced if DEBUG orCONFIG_DYNAMIC_DEBUG is not enabled.
drivers/media/media-entity.c +67 -1
@@ -27,6 +27,69 @@#include <media/media-device.h> /** +* dev_dbg_obj - Prints in debug mode a change on some object +* +* @event_name: Name of the event to report. Could be __func__ +* @gobj: Pointer to the object +* +* Enabled only if DEBUG or CONFIG_DYNAMIC_DEBUG. Otherwise, it +* won't produce any code. +*/ +static inline const char *gobj_type (enum media_gobj_type type) +{ +switch (type) { +case MEDIA_GRAPH_ENTITY : +return "entity" ; +case MEDIA_GRAPH_PAD : +return "pad" ; +case MEDIA_GRAPH_LINK : +return "link" ; +default : +return "unknown" ; + } +} + +static void dev_dbg_obj (const char *event_name,struct media_gobj *gobj) +{ +#if defined(DEBUG ) || defined (CONFIG_DYNAMIC_DEBUG ) +switch (media_type (gobj)) { +case MEDIA_GRAPH_ENTITY : +dev_dbg (gobj->mdev->dev, +"%s: id 0x%08x entity#%d: '%s'\n" , + event_name, gobj->id,media_localid (gobj), +gobj_to_entity (gobj)->name); +break ; +case MEDIA_GRAPH_LINK : + { +struct media_link *link =gobj_to_link (gobj); + +dev_dbg (gobj->mdev->dev, +"%s: id 0x%08x link#%d: '%s' %s#%d ==> '%s' %s#%d\n" , + event_name, gobj->id,media_localid (gobj), + + link->source->entity->name, +gobj_type (media_type (&link->source->graph_obj)), +media_localid (&link->source->graph_obj), + + link->sink->entity->name, +gobj_type (media_type (&link->sink->graph_obj)), +media_localid (&link->sink->graph_obj)); +break ; + } +case MEDIA_GRAPH_PAD : + { +struct media_pad *pad =gobj_to_pad (gobj); + +dev_dbg (gobj->mdev->dev, +"%s: id 0x%08x pad#%d: '%s':%d\n" , + event_name, gobj->id,media_localid (gobj), + pad->entity->name, pad->index); + } + } +#endif +} + +/** * media_gobj_init - Initialize a graph object * * @mdev: Pointer to the media_device that contains the object
@@ -43,6 +106,8 @@ void media_gobj_init(struct media_device *mdev,enum media_gobj_type type, struct media_gobj *gobj) { + gobj->mdev = mdev; +/* Create a per-type unique object ID */ switch (type) {case MEDIA_GRAPH_ENTITY :
@@ -55,6 +120,7 @@ void media_gobj_init(struct media_device *mdev, gobj->id =media_gobj_gen_id (type, ++mdev->link_id);break ; } +dev_dbg_obj (__func__, gobj); }/**
@@ -66,7 +132,7 @@ void media_gobj_init(struct media_device *mdev,*/ void media_gobj_remove (struct media_gobj *gobj) { -/* For now, nothing to do */ +dev_dbg_obj (__func__, gobj); }/**
include/media/media-entity.h +7 -0
@@ -61,6 +61,7 @@ enum media_gobj_type {* All elements on the media graph should have this struct embedded */ struct media_gobj { +struct media_device *mdev;u32 id; };
@@ -192,6 +193,12 @@ struct media_entity_graph {#define gobj_to_entity (gobj) \ container_of(gobj, struct media_entity, graph_obj) +#define gobj_to_pad (gobj) \ + container_of(gobj, struct media_pad, graph_obj) + +#define gobj_to_link (gobj) \ + container_of(gobj, struct media_link, graph_obj) +void media_gobj_init (struct media_device *mdev,enum media_gobj_type type,struct media_gobj *gobj);
Signature · 1 line
2.4.3
Re: [PATCH v6 7/8] [media] media: add a debug message to warn about gobj creation/removal
Quoted 7 lines · Mauro Carvalho Chehab
It helps to check if the media controller is doing the right thing with the object creation and removal.
No extra code/data will be produced if DEBUG or
CONFIG_DYNAMIC_DEBUGis not enabled.Signed-off-by Mauro Carvalho Chehab <[email protected]>
Thanks!
Hans
Quoted 127 lines
drivers/media/media-entity.c +67
-1@@ -27,6 +27,69 @@#include <media/media-device.h> /** +* dev_dbg_obj - Prints in debug mode a change on some object +* +* @event_name: Name of the event to report. Could be __func__ +* @gobj: Pointer to the object +* +* Enabled only if DEBUG or CONFIG_DYNAMIC_DEBUG. Otherwise, it +* won't produce any code. +*/ +static inline const char *gobj_type (enum media_gobj_type type) +{ +switch (type) { +case MEDIA_GRAPH_ENTITY : +return "entity" ; +case MEDIA_GRAPH_PAD : +return "pad" ; +case MEDIA_GRAPH_LINK : +return "link" ; +default : +return "unknown" ; + } +} + +static void dev_dbg_obj (const char *event_name,struct media_gobj *gobj) +{ +#if defined(DEBUG ) || defined (CONFIG_DYNAMIC_DEBUG ) +switch (media_type (gobj)) { +case MEDIA_GRAPH_ENTITY : +dev_dbg (gobj->mdev->dev, +"%s: id 0x%08x entity#%d: '%s'\n" , + event_name, gobj->id,media_localid (gobj), +gobj_to_entity (gobj)->name); +break ; +case MEDIA_GRAPH_LINK : + { +struct media_link *link =gobj_to_link (gobj); + +dev_dbg (gobj->mdev->dev, +"%s: id 0x%08x link#%d: '%s' %s#%d ==> '%s' %s#%d\n" , + event_name, gobj->id,media_localid (gobj), + + link->source->entity->name, +gobj_type (media_type (&link->source->graph_obj)), +media_localid (&link->source->graph_obj), + + link->sink->entity->name, +gobj_type (media_type (&link->sink->graph_obj)), +media_localid (&link->sink->graph_obj)); +break ; + } +case MEDIA_GRAPH_PAD : + { +struct media_pad *pad =gobj_to_pad (gobj); + +dev_dbg (gobj->mdev->dev, +"%s: id 0x%08x pad#%d: '%s':%d\n" , + event_name, gobj->id,media_localid (gobj), + pad->entity->name, pad->index); + } + } +#endif +} + +/** * media_gobj_init - Initialize a graph object * * @mdev: Pointer to the media_device that contains the object @@ -43,6 +106,8 @@ void media_gobj_init(struct media_device *mdev,enum media_gobj_type type, struct media_gobj *gobj) { + gobj->mdev = mdev; +/* Create a per-type unique object ID */ switch (type) {case MEDIA_GRAPH_ENTITY :@@ -55,6 +120,7 @@ void media_gobj_init(struct media_device *mdev, gobj->id =media_gobj_gen_id (type, ++mdev->link_id);break ; } +dev_dbg_obj (__func__, gobj); }/** @@ -66,7 +132,7 @@ void media_gobj_init(struct media_device *mdev,*/ void media_gobj_remove (struct media_gobj *gobj) { -/* For now, nothing to do */ +dev_dbg_obj (__func__, gobj); }/** include/media/media-entity.h +7
-0@@ -61,6 +61,7 @@ enum media_gobj_type {* All elements on the media graph should have this struct embedded */ struct media_gobj { +struct media_device *mdev;u32 id; };@@ -192,6 +193,12 @@ struct media_entity_graph {#define gobj_to_entity (gobj) \ container_of(gobj, struct media_entity, graph_obj) +#define gobj_to_pad (gobj) \ + container_of(gobj, struct media_pad, graph_obj) + +#define gobj_to_link (gobj) \ + container_of(gobj, struct media_link, graph_obj) +void media_gobj_init (struct media_device *mdev,enum media_gobj_type type,struct media_gobj *gobj);
Laurent Pinchart
maintainerRe: [PATCH v6 7/8] [media] media: add a debug message to warn about gobj creation/removal
In reply to Mauro Carvalho ChehabHi Mauro,
Thank you for the patch.
Quoted 5 lines · On Wednesday 19 August 2015 08:01:54 Mauro Carvalho Chehab wrote:
It helps to check if the media controller is doing the right thing with the object creation and removal.
No extra code/data will be produced if DEBUG or
CONFIG_DYNAMIC_DEBUGis not enabled.
CONFIG_DYNAMIC_DEBUG is often enabled.
You're more or less adding function call tracing in this patch, isn't that something that ftrace is supposed to do ?
Quoted 107 lines
Signed-off-by Mauro Carvalho Chehab <[email protected]>drivers/media/media-entity.c +67
-1@@ -27,6 +27,69 @@#include <media/media-device.h> /** +* dev_dbg_obj - Prints in debug mode a change on some object +* +* @event_name: Name of the event to report. Could be __func__ +* @gobj: Pointer to the object +* +* Enabled only if DEBUG or CONFIG_DYNAMIC_DEBUG. Otherwise, it +* won't produce any code. +*/ +static inline const char *gobj_type (enum media_gobj_type type) +{ +switch (type) { +case MEDIA_GRAPH_ENTITY : +return "entity" ; +case MEDIA_GRAPH_PAD : +return "pad" ; +case MEDIA_GRAPH_LINK : +return "link" ; +default : +return "unknown" ; + } +} + +static void dev_dbg_obj (const char *event_name,struct media_gobj *gobj) +{ +#if defined(DEBUG ) || defined (CONFIG_DYNAMIC_DEBUG ) +switch (media_type (gobj)) { +case MEDIA_GRAPH_ENTITY : +dev_dbg (gobj->mdev->dev, +"%s: id 0x%08x entity#%d: '%s'\n" , + event_name, gobj->id,media_localid (gobj), +gobj_to_entity (gobj)->name); +break ; +case MEDIA_GRAPH_LINK : + { +struct media_link *link =gobj_to_link (gobj); + +dev_dbg (gobj->mdev->dev, +"%s: id 0x%08x link#%d: '%s' %s#%d ==> '%s' %s#%d\n" , + event_name, gobj->id,media_localid (gobj), + + link->source->entity->name, +gobj_type (media_type (&link->source->graph_obj)), +media_localid (&link->source->graph_obj), + + link->sink->entity->name, +gobj_type (media_type (&link->sink->graph_obj)), +media_localid (&link->sink->graph_obj)); +break ; + } +case MEDIA_GRAPH_PAD : + { +struct media_pad *pad =gobj_to_pad (gobj); + +dev_dbg (gobj->mdev->dev, +"%s: id 0x%08x pad#%d: '%s':%d\n" , + event_name, gobj->id,media_localid (gobj), + pad->entity->name, pad->index); + } + } +#endif +} + +/** * media_gobj_init - Initialize a graph object * * @mdev: Pointer to the media_device that contains the object @@ -43,6 +106,8 @@ void media_gobj_init(struct media_device *mdev,enum media_gobj_type type, struct media_gobj *gobj) { + gobj->mdev = mdev; +/* Create a per-type unique object ID */ switch (type) {case MEDIA_GRAPH_ENTITY :@@ -55,6 +120,7 @@ void media_gobj_init(struct media_device *mdev, gobj->id =media_gobj_gen_id (type, ++mdev->link_id);break ; } +dev_dbg_obj (__func__, gobj); }/** @@ -66,7 +132,7 @@ void media_gobj_init(struct media_device *mdev,*/ void media_gobj_remove (struct media_gobj *gobj) { -/* For now, nothing to do */ +dev_dbg_obj (__func__, gobj); }/** include/media/media-entity.h +0
-0
include/media/media-entity.h enum media_gobj_type { · line 64
Quoted 4 lines
include/media/media-entity.h +1
-0@@ -61,6 +61,7 @@ enum media_gobj_type {* All elements on the media graph should have this struct embedded */ struct media_gobj { +struct media_device *mdev;
I'd move this to the patch that introduces media_gobj.
include/media/media-entity.h struct media_entity_graph { · line 201
Quoted 13 lines
include/media/media-entity.h +6
-0u32 id; };@@ -192,6 +193,12 @@ struct media_entity_graph {#define gobj_to_entity (gobj) \ container_of(gobj, struct media_entity, graph_obj) +#define gobj_to_pad (gobj) \ + container_of(gobj, struct media_pad, graph_obj) + +#define gobj_to_link (gobj) \ + container_of(gobj, struct media_link, graph_obj) +
And I'd call these media_gobj_* as commented on patch 2/8.
Quoted 3 lines
include/media/media-entity.h +0
-0void media_gobj_init (struct media_device *mdev,enum media_gobj_type type,struct media_gobj *gobj);
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v6 7/8] [media] media: add a debug message to warn about gobj creation/removal
Em Fri, 21 Aug 2015 04:32:51 +0300
Laurent Pinchart <[email protected]> escreveu:
Quoted 4 lines
Hi Mauro,
Thank you for the patch.
Quoted 8 lines
Quoted 5 lines · On Wednesday 19 August 2015 08:01:54 Mauro Carvalho Chehab wrote:
It helps to check if the media controller is doing the right thing with the object creation and removal.
No extra code/data will be produced if DEBUG or
CONFIG_DYNAMIC_DEBUGis not enabled.
CONFIG_DYNAMIC_DEBUGis often enabled.
True, but once a driver/core is properly debugged, images without DEBUG could be used in production, if the amount of memory constraints are too tight.
Quoted 2 lines
You're more or less adding function call tracing in this patch, isn't that something that ftrace is supposed to do ?
Ftrace is a great infrastructure and helps a lot when we need to identify bottlenecks and other performance related stuff, but it doesn't replace debug functions.
There are some fundamental differences on what you could do with ftrace and what you can't.
At least on this stage, what I need is something that will provide output via serial console when the driver gets loaded, and that provides a synchronous output with the other Kernel messages.
This is the only way to debug certain OOPSes that are happening during the development of the patches.
This is something you cannot do with ftrace, but dynamic DEBUG works like a charm.
Quoted 135 lines
Quoted 108 lines
Signed-off-by Mauro Carvalho Chehab <[email protected]>drivers/media/media-entity.c +67
-1@@ -27,6 +27,69 @@#include <media/media-device.h> /** +* dev_dbg_obj - Prints in debug mode a change on some object +* +* @event_name: Name of the event to report. Could be __func__ +* @gobj: Pointer to the object +* +* Enabled only if DEBUG or CONFIG_DYNAMIC_DEBUG. Otherwise, it +* won't produce any code. +*/ +static inline const char *gobj_type (enum media_gobj_type type) +{ +switch (type) { +case MEDIA_GRAPH_ENTITY : +return "entity" ; +case MEDIA_GRAPH_PAD : +return "pad" ; +case MEDIA_GRAPH_LINK : +return "link" ; +default : +return "unknown" ; + } +} + +static void dev_dbg_obj (const char *event_name,struct media_gobj *gobj) +{ +#if defined(DEBUG ) || defined (CONFIG_DYNAMIC_DEBUG ) +switch (media_type (gobj)) { +case MEDIA_GRAPH_ENTITY : +dev_dbg (gobj->mdev->dev, +"%s: id 0x%08x entity#%d: '%s'\n" , + event_name, gobj->id,media_localid (gobj), +gobj_to_entity (gobj)->name); +break ; +case MEDIA_GRAPH_LINK : + { +struct media_link *link =gobj_to_link (gobj); + +dev_dbg (gobj->mdev->dev, +"%s: id 0x%08x link#%d: '%s' %s#%d ==> '%s' %s#%d\n" , + event_name, gobj->id,media_localid (gobj), + + link->source->entity->name, +gobj_type (media_type (&link->source->graph_obj)), +media_localid (&link->source->graph_obj), + + link->sink->entity->name, +gobj_type (media_type (&link->sink->graph_obj)), +media_localid (&link->sink->graph_obj)); +break ; + } +case MEDIA_GRAPH_PAD : + { +struct media_pad *pad =gobj_to_pad (gobj); + +dev_dbg (gobj->mdev->dev, +"%s: id 0x%08x pad#%d: '%s':%d\n" , + event_name, gobj->id,media_localid (gobj), + pad->entity->name, pad->index); + } + } +#endif +} + +/** * media_gobj_init - Initialize a graph object * * @mdev: Pointer to the media_device that contains the object @@ -43,6 +106,8 @@ void media_gobj_init(struct media_device *mdev,enum media_gobj_type type, struct media_gobj *gobj) { + gobj->mdev = mdev; +/* Create a per-type unique object ID */ switch (type) {case MEDIA_GRAPH_ENTITY :@@ -55,6 +120,7 @@ void media_gobj_init(struct media_device *mdev, gobj->id =media_gobj_gen_id (type, ++mdev->link_id);break ; } +dev_dbg_obj (__func__, gobj); }/** @@ -66,7 +132,7 @@ void media_gobj_init(struct media_device *mdev,*/ void media_gobj_remove (struct media_gobj *gobj) { -/* For now, nothing to do */ +dev_dbg_obj (__func__, gobj); }/** include/media/media-entity.h +0
-0include/media/media-entity.h enum media_gobj_type { · line 64
Quoted 4 lines
include/media/media-entity.h +1
-0@@ -61,6 +61,7 @@ enum media_gobj_type {* All elements on the media graph should have this struct embedded */ struct media_gobj { +struct media_device *mdev;I'd move this to the patch that introduces
media_gobj.include/media/media-entity.h struct media_entity_graph { · line 201
Quoted 13 lines
include/media/media-entity.h +6
-0u32 id; };@@ -192,6 +193,12 @@ struct media_entity_graph {#define gobj_to_entity (gobj) \ container_of(gobj, struct media_entity, graph_obj) +#define gobj_to_pad (gobj) \ + container_of(gobj, struct media_pad, graph_obj) + +#define gobj_to_link (gobj) \ + container_of(gobj, struct media_link, graph_obj) +And I'd call these media_gobj_* as commented on patch 2/8.
Quoted 3 lines
include/media/media-entity.h +0
-0void media_gobj_init (struct media_device *mdev,enum media_gobj_type type,struct media_gobj *gobj);
Laurent Pinchart
maintainerRe: [PATCH v6 7/8] [media] media: add a debug message to warn about gobj creation/removal
Hi Mauro,
Quoted 28 lines · On Friday 21 August 2015 07:19:21 Mauro Carvalho Chehab wrote:
Em Fri, 21 Aug 2015 04:32:51 +0300 Laurent Pinchart escreveu:
Quoted 8 lines · On Wednesday 19 August 2015 08:01:54 Mauro Carvalho Chehab wrote:
Quoted 5 lines
It helps to check if the media controller is doing the right thing with the object creation and removal.
No extra code/data will be produced if DEBUG or
CONFIG_DYNAMIC_DEBUGis not enabled.
CONFIG_DYNAMIC_DEBUGis often enabled.True, but once a driver/core is properly debugged, images without DEBUG could be used in production, if the amount of memory constraints are too tight.
Quoted 2 lines
You're more or less adding function call tracing in this patch, isn't that something that ftrace is supposed to do ?
Ftrace is a great infrastructure and helps a lot when we need to identify bottlenecks and other performance related stuff, but it doesn't replace debug functions.
There are some fundamental differences on what you could do with ftrace and what you can't.
At least on this stage, what I need is something that will provide output via serial console when the driver gets loaded, and that provides a synchronous output with the other Kernel messages.
Quoted 5 lines
This is the only way to debug certain OOPSes that are happening during the development of the patches.
This is something you cannot do with ftrace, but dynamic DEBUG works like a charm.
I understand the need for debug messages during development of a patch series, but I don't think this level of debugging belongs to mainline. Debug messages for function call tracing, even more in patch 6/8 and 7/8, is frowned upon in the kernel.
Or maybe I got it wrong and patches 6/8 and 7/8 are only for development and you don't plan to get them in mainline ?
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v6 7/8] [media] media: add a debug message to warn about gobj creation/removal
Em Fri, 21 Aug 2015 20:54:29 +0300
Laurent Pinchart <[email protected]> escreveu:
Quoted 37 lines
Hi Mauro,
Quoted 28 lines · On Friday 21 August 2015 07:19:21 Mauro Carvalho Chehab wrote:
Em Fri, 21 Aug 2015 04:32:51 +0300 Laurent Pinchart escreveu:
Quoted 8 lines · On Wednesday 19 August 2015 08:01:54 Mauro Carvalho Chehab wrote:
Quoted 5 lines
It helps to check if the media controller is doing the right thing with the object creation and removal.
No extra code/data will be produced if DEBUG or
CONFIG_DYNAMIC_DEBUGis not enabled.
CONFIG_DYNAMIC_DEBUGis often enabled.True, but once a driver/core is properly debugged, images without DEBUG could be used in production, if the amount of memory constraints are too tight.
Quoted 2 lines
You're more or less adding function call tracing in this patch, isn't that something that ftrace is supposed to do ?
Ftrace is a great infrastructure and helps a lot when we need to identify bottlenecks and other performance related stuff, but it doesn't replace debug functions.
There are some fundamental differences on what you could do with ftrace and what you can't.
At least on this stage, what I need is something that will provide output via serial console when the driver gets loaded, and that provides a synchronous output with the other Kernel messages.
Quoted 5 lines
This is the only way to debug certain OOPSes that are happening during the development of the patches.
This is something you cannot do with ftrace, but dynamic DEBUG works like a charm.
Quoted 7 lines
I understand the need for debug messages during development of a patch series, but I don't think this level of debugging belongs to mainline. Debug messages for function call tracing, even more in patch 6/8 and 7/8, is frowned upon in the kernel.
Or maybe I got it wrong and patches 6/8 and 7/8 are only for development and you don't plan to get them in mainline ?
As we've agreed, the first phase won't have dynamic support. Both patches 6/8 and 7/8 are important until then.
So, they should reach mainline together with the first MC new gen series.
Patch 6/8 can be reverted after we finish implementing dynamic support.
I think patch 7/8 will still be a good debug feature, but we can discuss about that after implementing dynamic support.
Regards,
Mauro
Laurent Pinchart
maintainerRe: [PATCH v6 7/8] [media] media: add a debug message to warn about gobj creation/removal
Hi Mauro,
Quoted 41 lines · On Friday 21 August 2015 18:09:31 Mauro Carvalho Chehab wrote:
Em Fri, 21 Aug 2015 20:54:29 +0300 Laurent Pinchart escreveu:
Quoted 40 lines · On Friday 21 August 2015 07:19:21 Mauro Carvalho Chehab wrote:
Quoted 28 lines
Em Fri, 21 Aug 2015 04:32:51 +0300 Laurent Pinchart escreveu:
Quoted 8 lines · On Wednesday 19 August 2015 08:01:54 Mauro Carvalho Chehab wrote:
Quoted 5 lines
It helps to check if the media controller is doing the right thing with the object creation and removal.
No extra code/data will be produced if DEBUG or
CONFIG_DYNAMIC_DEBUGis not enabled.
CONFIG_DYNAMIC_DEBUGis often enabled.True, but once a driver/core is properly debugged, images without DEBUG could be used in production, if the amount of memory constraints are too tight.
Quoted 2 lines
You're more or less adding function call tracing in this patch, isn't that something that ftrace is supposed to do ?
Ftrace is a great infrastructure and helps a lot when we need to identify bottlenecks and other performance related stuff, but it doesn't replace debug functions.
There are some fundamental differences on what you could do with ftrace and what you can't.
At least on this stage, what I need is something that will provide output via serial console when the driver gets loaded, and that provides a synchronous output with the other Kernel messages.
Quoted 5 lines
This is the only way to debug certain OOPSes that are happening during the development of the patches.
This is something you cannot do with ftrace, but dynamic DEBUG works like a charm.
I understand the need for debug messages during development of a patch series, but I don't think this level of debugging belongs to mainline. Debug messages for function call tracing, even more in patch 6/8 and 7/8, is frowned upon in the kernel.
Quoted 5 lines
Quoted 2 lines
Or maybe I got it wrong and patches 6/8 and 7/8 are only for development and you don't plan to get them in mainline ?
As we've agreed, the first phase won't have dynamic support. Both patches 6/8 and 7/8 are important until then.
Why are they more important with dynamic support ?
Quoted 1 line
So, they should reach mainline together with the first MC new gen series.
Patch 6/8 states in its commit message that
"We can only free the media device after being sure that no graph object is used. In order to help tracking it, let's add debug messages that will print when the media controller gets registered or unregistered."
Instead of debug messages that need to be enabled and tracked manually, why not detecting the condition and issuing a WARN_ON() ?
Quoted 4 lines
Patch 6/8 can be reverted after we finish implementing dynamic support.
I think patch 7/8 will still be a good debug feature, but we can discuss about that after implementing dynamic support.
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v6 7/8] [media] media: add a debug message to warn about gobj creation/removal
Em Sat, 22 Aug 2015 01:54:07 +0300
Laurent Pinchart <[email protected]> escreveu:
Quoted 44 lines
Hi Mauro,
Quoted 41 lines · On Friday 21 August 2015 18:09:31 Mauro Carvalho Chehab wrote:
Em Fri, 21 Aug 2015 20:54:29 +0300 Laurent Pinchart escreveu:
Quoted 40 lines · On Friday 21 August 2015 07:19:21 Mauro Carvalho Chehab wrote:
Quoted 28 lines
Em Fri, 21 Aug 2015 04:32:51 +0300 Laurent Pinchart escreveu:
Quoted 8 lines · On Wednesday 19 August 2015 08:01:54 Mauro Carvalho Chehab wrote:
Quoted 5 lines
It helps to check if the media controller is doing the right thing with the object creation and removal.
No extra code/data will be produced if DEBUG or
CONFIG_DYNAMIC_DEBUGis not enabled.
CONFIG_DYNAMIC_DEBUGis often enabled.True, but once a driver/core is properly debugged, images without DEBUG could be used in production, if the amount of memory constraints are too tight.
Quoted 2 lines
You're more or less adding function call tracing in this patch, isn't that something that ftrace is supposed to do ?
Ftrace is a great infrastructure and helps a lot when we need to identify bottlenecks and other performance related stuff, but it doesn't replace debug functions.
There are some fundamental differences on what you could do with ftrace and what you can't.
At least on this stage, what I need is something that will provide output via serial console when the driver gets loaded, and that provides a synchronous output with the other Kernel messages.
Quoted 5 lines
This is the only way to debug certain OOPSes that are happening during the development of the patches.
This is something you cannot do with ftrace, but dynamic DEBUG works like a charm.
I understand the need for debug messages during development of a patch series, but I don't think this level of debugging belongs to mainline. Debug messages for function call tracing, even more in patch 6/8 and 7/8, is frowned upon in the kernel.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Or maybe I got it wrong and patches 6/8 and 7/8 are only for development and you don't plan to get them in mainline ?
As we've agreed, the first phase won't have dynamic support. Both patches 6/8 and 7/8 are important until then.
Why are they more important with dynamic support ?
Because it helps to identify if the creation/removal of the objects are being done at the right order. If the media_device got unregistered and kfreed before unregistering the devices, things will go bad. Also, a PAD can't be destroyed if any links that reference it still exists.
I got tons of troubles like that during the development of the PATCH v7 series.
Quoted 10 lines
Quoted 1 line
So, they should reach mainline together with the first MC new gen series.
Patch 6/8 states in its commit message that
"We can only free the media device after being sure that no graph object is used. In order to help tracking it, let's add debug messages that will print when the media controller gets registered or unregistered."
Instead of debug messages that need to be enabled and tracked manually, why not detecting the condition and issuing a
WARN_ON()?
Because I'm not sure how to write such patch ;) I don't know any algorithm that could be used to detect that a kfree() happening at the wrong order.
My old proposal were to use kref() for that, but neither you nor Lars saw the need for that. Also, after looking deeper in the code, adding a kref() for the graph objects isn't trivial.
My original idea to support dynamic objects is to have a code at media_graph_init() that would increment the kref() count for the created object and for the referenced objects (like the two pads on a data link and the media_device), and decrementing kref() at media_graph_remove(). The actual function that would free the memory would be called when kref() count reaches zero.
In other words, if we add a kref() count for the objects and for media_device, then we can get rid of patch 6/8, but we're not there yet.
For that to work, there are several changes that would be needed:
- The media_device should be dynamically allocated;
- All graph objects can only be created after having the media device created, and should not be embedded;
- The PAD allocation should be moved to the MC core.
IMO, that's the best solution if we were starting to design MC right now. However, changing the drivers at this moment to do that will require retest the MC there, with means that the driver maintainer should very likely be helping. That's an unlikely scenario, unfortunately.
So, I guess we'll need to find another way. That's why we need to keep patch 6/8 until we figure out a solution for that.
Regards,
Mauro
PATCH v6 8/8 media: rename the function that create pad links
In reply to Mauro Carvalho ChehabNow that a link can be either between two different graph objects, we'll need to add more functions to create links. So, rename the existing one that create links only between two pads as media_create_pad_link().
No functional changes.
This patch was created via this shell script:
for i in $(find drivers/media -name '*.[ch]' -type f) $(find drivers/staging/media -name '*.[ch]' -type f) $(find include/ -name '*.h' -type f) ; do sed s,media_entity_create_link,media_create_pad_link,g <$i >a && mv a $i; done
Documentation/media-framework.txt +1 -1
@@ -199,7 +199,7 @@ pre-allocated and grows dynamically as needed. Drivers create links by calling - media_entity_create_link(struct media_entity *source, u16 source_pad, + media_create_pad_link(struct media_entity *source, u16 source_pad, struct media_entity *sink, u16 sink_pad, u32 flags);
drivers/media/dvb-core/dvbdev.c +4 -4
@@ -412,16 +412,16 @@ void dvb_create_media_graph(struct dvb_adapter *adap) }if (tuner && fe) -media_entity_create_link (tuner,0 , fe,0 ,0 ); +media_create_pad_link (tuner,0 , fe,0 ,0 );if (fe && demux) -media_entity_create_link (fe,1 , demux,0 ,MEDIA_LNK_FL_ENABLED ); +media_create_pad_link (fe,1 , demux,0 ,MEDIA_LNK_FL_ENABLED );if (demux && dvr) -media_entity_create_link (demux,1 , dvr,0 ,MEDIA_LNK_FL_ENABLED ); +media_create_pad_link (demux,1 , dvr,0 ,MEDIA_LNK_FL_ENABLED );if (demux && ca) -media_entity_create_link (demux,1 , ca,0 ,MEDIA_LNK_FL_ENABLED ); +media_create_pad_link (demux,1 , ca,0 ,MEDIA_LNK_FL_ENABLED ); }EXPORT_SYMBOL_GPL (dvb_create_media_graph);#endif
drivers/media/i2c/s5c73m3/s5c73m3-core.c +2 -2
@@ -1482,11 +1482,11 @@ static int s5c73m3_oif_registered(struct v4l2_subdev *sd)return ret; } - ret =media_entity_create_link (&state->sensor_sd.entity, + ret =media_create_pad_link (&state->sensor_sd.entity,S5C73M3_ISP_PAD , &state->oif_sd.entity,OIF_ISP_PAD ,MEDIA_LNK_FL_IMMUTABLE |MEDIA_LNK_FL_ENABLED ); - ret =media_entity_create_link (&state->sensor_sd.entity, + ret =media_create_pad_link (&state->sensor_sd.entity,S5C73M3_JPEG_PAD , &state->oif_sd.entity,OIF_JPEG_PAD ,MEDIA_LNK_FL_IMMUTABLE |MEDIA_LNK_FL_ENABLED );
drivers/media/i2c/s5k5baf.c +1 -1
@@ -1756,7 +1756,7 @@ static int s5k5baf_registered(struct v4l2_subdev *sd)v4l2_err (sd,"failed to register subdev %s\n" , state->cis_sd.name); else - ret =media_entity_create_link (&state->cis_sd.entity,PAD_CIS , + ret =media_create_pad_link (&state->cis_sd.entity,PAD_CIS , &state->sd.entity,PAD_CIS ,MEDIA_LNK_FL_IMMUTABLE |MEDIA_LNK_FL_ENABLED );
drivers/media/i2c/smiapp/smiapp-core.c +2 -2
@@ -2495,7 +2495,7 @@ static int smiapp_register_subdevs(struct smiapp_sensor *sensor)return rval; } - rval = media_entity_create_link(&this->sd.entity, + rval = media_create_pad_link(&this->sd.entity, this->source_pad, &last->sd.entity, last->sink_pad,
@@ -2503,7 +2503,7 @@ static int smiapp_register_subdevs(struct smiapp_sensor *sensor) MEDIA_LNK_FL_IMMUTABLE);if (rval) {dev_err (&client->dev, -"media_entity_create_link failed\n" ); +"media_create_pad_link failed\n" );return rval; }
drivers/media/media-entity.c +2 -2
@@ -542,7 +542,7 @@ static struct media_link *media_entity_add_link(struct media_entity *entity) }int -media_entity_create_link (struct media_entity *source,u16 source_pad, +media_create_pad_link (struct media_entity *source,u16 source_pad,struct media_entity *sink,u16 sink_pad,u32 flags) {struct media_link *link;
@@ -586,7 +586,7 @@ media_entity_create_link(struct media_entity *source, u16 source_pad,return 0 ; } -EXPORT_SYMBOL_GPL (media_entity_create_link); +EXPORT_SYMBOL_GPL (media_create_pad_link);void __media_entity_remove_links (struct media_entity *entity) {
drivers/media/platform/exynos4-is/media-dev.c +8 -8
@@ -729,7 +729,7 @@ static int __fimc_md_create_fimc_sink_links(struct fimc_md *fmd, flags = ((1 << i) & link_mask) ?MEDIA_LNK_FL_ENABLED :0 ; sink = &fmd->fimc[i]->vid_cap.subdev.entity; - ret =media_entity_create_link (source, pad, sink, + ret =media_create_pad_link (source, pad, sink,FIMC_SD_PAD_SINK_CAM , flags);if (ret)return ret;
@@ -749,7 +749,7 @@ static int __fimc_md_create_fimc_sink_links(struct fimc_md *fmd,continue ; sink = &fmd->fimc_lite[i]->subdev.entity; - ret =media_entity_create_link (source, pad, sink, + ret =media_create_pad_link (source, pad, sink,FLITE_SD_PAD_SINK ,0 );if (ret)return ret;
@@ -781,13 +781,13 @@ static int __fimc_md_create_flite_source_links(struct fimc_md *fmd) source = &fimc->subdev.entity; sink = &fimc->ve.vdev.entity;/* FIMC-LITE's subdev and video node */ - ret =media_entity_create_link (source,FLITE_SD_PAD_SOURCE_DMA , + ret =media_create_pad_link (source,FLITE_SD_PAD_SOURCE_DMA , sink,0 ,0 );if (ret)break ;/* Link from FIMC-LITE to IS-ISP subdev */ sink = &fmd->fimc_is->isp.subdev.entity; - ret =media_entity_create_link (source,FLITE_SD_PAD_SOURCE_ISP , + ret =media_create_pad_link (source,FLITE_SD_PAD_SOURCE_ISP , sink,0 ,0 );if (ret)break ;
@@ -811,7 +811,7 @@ static int __fimc_md_create_fimc_is_links(struct fimc_md *fmd)/* Link from FIMC-IS-ISP subdev to FIMC */ sink = &fmd->fimc[i]->vid_cap.subdev.entity; - ret =media_entity_create_link (source,FIMC_ISP_SD_PAD_SRC_FIFO , + ret =media_create_pad_link (source,FIMC_ISP_SD_PAD_SRC_FIFO , sink,FIMC_SD_PAD_SINK_FIFO ,0 );if (ret)return ret;
@@ -824,7 +824,7 @@ static int __fimc_md_create_fimc_is_links(struct fimc_md *fmd)if (sink->num_pads ==0 )return 0 ; -return media_entity_create_link (source,FIMC_ISP_SD_PAD_SRC_DMA , +return media_create_pad_link (source,FIMC_ISP_SD_PAD_SRC_DMA , sink,0 ,0 ); }
@@ -873,7 +873,7 @@ static int fimc_md_create_links(struct fimc_md *fmd)return -EINVAL ; pad = sensor->entity.num_pads -1 ; - ret =media_entity_create_link (&sensor->entity, pad, + ret =media_create_pad_link (&sensor->entity, pad, &csis->entity,CSIS_PAD_SINK ,MEDIA_LNK_FL_IMMUTABLE |MEDIA_LNK_FL_ENABLED );
@@ -927,7 +927,7 @@ static int fimc_md_create_links(struct fimc_md *fmd) source = &fmd->fimc[i]->vid_cap.subdev.entity; sink = &fmd->fimc[i]->vid_cap.ve.vdev.entity; - ret =media_entity_create_link (source,FIMC_SD_PAD_SOURCE , + ret =media_create_pad_link (source,FIMC_SD_PAD_SOURCE , sink,0 , flags);if (ret)break ;
drivers/media/platform/omap3isp/isp.c +9 -9
@@ -1862,7 +1862,7 @@ static int isp_link_entity(return -EINVAL ; } -return media_entity_create_link (entity, i, input, pad, flags); +return media_create_pad_link (entity, i, input, pad, flags); }static int isp_register_entities (struct isp_device *isp)
@@ -2001,51 +2001,51 @@ static int isp_initialize_modules(struct isp_device *isp) }/* Connect the submodules. */ - ret =media_entity_create_link ( + ret =media_create_pad_link ( &isp->isp_csi2a.subdev.entity,CSI2_PAD_SOURCE , &isp->isp_ccdc.subdev.entity,CCDC_PAD_SINK ,0 );if (ret <0 ) goto error_link; - ret =media_entity_create_link ( + ret =media_create_pad_link ( &isp->isp_ccp2.subdev.entity,CCP2_PAD_SOURCE , &isp->isp_ccdc.subdev.entity,CCDC_PAD_SINK ,0 );if (ret <0 ) goto error_link; - ret =media_entity_create_link ( + ret =media_create_pad_link ( &isp->isp_ccdc.subdev.entity,CCDC_PAD_SOURCE_VP , &isp->isp_prev.subdev.entity,PREV_PAD_SINK ,0 );if (ret <0 ) goto error_link; - ret =media_entity_create_link ( + ret =media_create_pad_link ( &isp->isp_ccdc.subdev.entity,CCDC_PAD_SOURCE_OF , &isp->isp_res.subdev.entity,RESZ_PAD_SINK ,0 );if (ret <0 ) goto error_link; - ret =media_entity_create_link ( + ret =media_create_pad_link ( &isp->isp_prev.subdev.entity,PREV_PAD_SOURCE , &isp->isp_res.subdev.entity,RESZ_PAD_SINK ,0 );if (ret <0 ) goto error_link; - ret =media_entity_create_link ( + ret =media_create_pad_link ( &isp->isp_ccdc.subdev.entity,CCDC_PAD_SOURCE_VP , &isp->isp_aewb.subdev.entity,0 ,MEDIA_LNK_FL_ENABLED |MEDIA_LNK_FL_IMMUTABLE );if (ret <0 ) goto error_link; - ret =media_entity_create_link ( + ret =media_create_pad_link ( &isp->isp_ccdc.subdev.entity,CCDC_PAD_SOURCE_VP , &isp->isp_af.subdev.entity,0 ,MEDIA_LNK_FL_ENABLED |MEDIA_LNK_FL_IMMUTABLE );if (ret <0 ) goto error_link; - ret =media_entity_create_link ( + ret =media_create_pad_link ( &isp->isp_ccdc.subdev.entity,CCDC_PAD_SOURCE_VP , &isp->isp_hist.subdev.entity,0 ,MEDIA_LNK_FL_ENABLED |MEDIA_LNK_FL_IMMUTABLE );
drivers/media/platform/omap3isp/ispccdc.c +1 -1
@@ -2667,7 +2667,7 @@ static int ccdc_init_entities(struct isp_ccdc_device *ccdc) goto error_video;/* Connect the CCDC subdev to the video node. */ - ret =media_entity_create_link (&ccdc->subdev.entity,CCDC_PAD_SOURCE_OF , + ret =media_create_pad_link (&ccdc->subdev.entity,CCDC_PAD_SOURCE_OF , &ccdc->video_out.video.entity,0 ,0 );if (ret <0 ) goto error_link;
drivers/media/platform/omap3isp/ispccp2.c +1 -1
@@ -1100,7 +1100,7 @@ static int ccp2_init_entities(struct isp_ccp2_device *ccp2) goto error_video;/* Connect the video node to the ccp2 subdev. */ - ret =media_entity_create_link (&ccp2->video_in.video.entity,0 , + ret =media_create_pad_link (&ccp2->video_in.video.entity,0 , &ccp2->subdev.entity,CCP2_PAD_SINK ,0 );if (ret <0 ) goto error_link;
drivers/media/platform/omap3isp/ispcsi2.c +1 -1
@@ -1265,7 +1265,7 @@ static int csi2_init_entities(struct isp_csi2_device *csi2) goto error_video;/* Connect the CSI2 subdev to the video node. */ - ret =media_entity_create_link (&csi2->subdev.entity,CSI2_PAD_SOURCE , + ret =media_create_pad_link (&csi2->subdev.entity,CSI2_PAD_SOURCE , &csi2->video_out.video.entity,0 ,0 );if (ret <0 ) goto error_link;
drivers/media/platform/omap3isp/isppreview.c +2 -2
@@ -2312,12 +2312,12 @@ static int preview_init_entities(struct isp_prev_device *prev) goto error_video_out;/* Connect the video nodes to the previewer subdev. */ - ret =media_entity_create_link (&prev->video_in.video.entity,0 , + ret =media_create_pad_link (&prev->video_in.video.entity,0 , &prev->subdev.entity,PREV_PAD_SINK ,0 );if (ret <0 ) goto error_link; - ret =media_entity_create_link (&prev->subdev.entity,PREV_PAD_SOURCE , + ret =media_create_pad_link (&prev->subdev.entity,PREV_PAD_SOURCE , &prev->video_out.video.entity,0 ,0 );if (ret <0 ) goto error_link;
drivers/media/platform/omap3isp/ispresizer.c +2 -2
@@ -1756,12 +1756,12 @@ static int resizer_init_entities(struct isp_res_device *res) res->video_out.video.entity.flags |=MEDIA_ENT_FL_DEFAULT ;/* Connect the video nodes to the resizer subdev. */ - ret =media_entity_create_link (&res->video_in.video.entity,0 , + ret =media_create_pad_link (&res->video_in.video.entity,0 , &res->subdev.entity,RESZ_PAD_SINK ,0 );if (ret <0 ) goto error_link; - ret =media_entity_create_link (&res->subdev.entity,RESZ_PAD_SOURCE , + ret =media_create_pad_link (&res->subdev.entity,RESZ_PAD_SOURCE , &res->video_out.video.entity,0 ,0 );if (ret <0 ) goto error_link;
drivers/media/platform/s3c-camif/camif-core.c +2 -2
@@ -263,7 +263,7 @@ static int camif_create_media_links(struct camif_dev *camif) {int i, ret; - ret =media_entity_create_link (&camif->sensor.sd->entity,0 , + ret =media_create_pad_link (&camif->sensor.sd->entity,0 , &camif->subdev.entity,CAMIF_SD_PAD_SINK ,MEDIA_LNK_FL_IMMUTABLE |MEDIA_LNK_FL_ENABLED );
@@ -271,7 +271,7 @@ static int camif_create_media_links(struct camif_dev *camif)return ret;for (i =1 ; i <CAMIF_SD_PADS_NUM && !ret; i++) { - ret =media_entity_create_link (&camif->subdev.entity, i, + ret =media_create_pad_link (&camif->subdev.entity, i, &camif->vp[i -1 ].vdev.entity,0 ,MEDIA_LNK_FL_IMMUTABLE |MEDIA_LNK_FL_ENABLED );
drivers/media/platform/vsp1/vsp1_drv.c +2 -2
@@ -101,7 +101,7 @@ static int vsp1_create_links(struct vsp1_device *vsp1, struct vsp1_entity *sink)if (!(entity->pads[pad].flags &MEDIA_PAD_FL_SINK ))continue ; - ret =media_entity_create_link (&source->subdev.entity, + ret =media_create_pad_link (&source->subdev.entity, source->source_pad, entity, pad, flags);if (ret <0 )
@@ -262,7 +262,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) }if (vsp1->pdata.features &VSP1_HAS_LIF ) { - ret =media_entity_create_link ( + ret =media_create_pad_link ( &vsp1->wpf[0 ]->entity.subdev.entity,RWPF_PAD_SOURCE , &vsp1->lif->entity.subdev.entity,LIF_PAD_SINK ,0 );if (ret <0 )
drivers/media/platform/vsp1/vsp1_rpf.c +1 -1
@@ -278,7 +278,7 @@ struct vsp1_rwpf *vsp1_rpf_create(struct vsp1_device *vsp1, unsigned int index) rpf->entity.video = video;/* Connect the video device to the RPF. */ - ret = media_entity_create_link(&rpf->video.video.entity, 0, + ret = media_create_pad_link(&rpf->video.video.entity, 0, &rpf->entity.subdev.entity, RWPF_PAD_SINK, MEDIA_LNK_FL_ENABLED |
drivers/media/platform/vsp1/vsp1_wpf.c +1 -1
@@ -284,7 +284,7 @@ struct vsp1_rwpf *vsp1_wpf_create(struct vsp1_device *vsp1, unsigned int index)if (!(vsp1->pdata.features &VSP1_HAS_LIF ) || index !=0 ) flags |=MEDIA_LNK_FL_IMMUTABLE ; - ret =media_entity_create_link (&wpf->entity.subdev.entity, + ret =media_create_pad_link (&wpf->entity.subdev.entity,RWPF_PAD_SOURCE , &wpf->video.video.entity,0 , flags);if (ret <0 )
drivers/media/platform/xilinx/xilinx-vipp.c +2 -2
@@ -156,7 +156,7 @@ static int xvip_graph_build_one(struct xvip_composite_device *xdev, local->name, local_pad->index, remote->name, remote_pad->index); - ret =media_entity_create_link (local, local_pad->index, + ret =media_create_pad_link (local, local_pad->index, remote, remote_pad->index, link_flags);if (ret <0 ) {
@@ -270,7 +270,7 @@ static int xvip_graph_build_dma(struct xvip_composite_device *xdev) source->name, source_pad->index, sink->name, sink_pad->index); - ret =media_entity_create_link (source, source_pad->index, + ret =media_create_pad_link (source, source_pad->index, sink, sink_pad->index, link_flags);if (ret <0 ) {
drivers/media/usb/au0828/au0828-core.c +3 -3
@@ -260,13 +260,13 @@ static void au0828_create_media_graph(struct au0828_dev *dev)return ;if (tuner) -media_entity_create_link (tuner,0 , decoder,0 , +media_create_pad_link (tuner,0 , decoder,0 ,MEDIA_LNK_FL_ENABLED );if (dev->vdev.entity.links) -media_entity_create_link (decoder,1 , &dev->vdev.entity,0 , +media_create_pad_link (decoder,1 , &dev->vdev.entity,0 ,MEDIA_LNK_FL_ENABLED );if (dev->vbi_dev.entity.links) -media_entity_create_link (decoder,2 , &dev->vbi_dev.entity,0 , +media_create_pad_link (decoder,2 , &dev->vbi_dev.entity,0 ,MEDIA_LNK_FL_ENABLED );#endif }
drivers/media/usb/cx231xx/cx231xx-cards.c +3 -3
@@ -1264,11 +1264,11 @@ static void cx231xx_create_media_graph(struct cx231xx *dev)return ;if (tuner) -media_entity_create_link (tuner,0 , decoder,0 , +media_create_pad_link (tuner,0 , decoder,0 ,MEDIA_LNK_FL_ENABLED ); -media_entity_create_link (decoder,1 , &dev->vdev.entity,0 , +media_create_pad_link (decoder,1 , &dev->vdev.entity,0 ,MEDIA_LNK_FL_ENABLED ); -media_entity_create_link (decoder,2 , &dev->vbi_dev.entity,0 , +media_create_pad_link (decoder,2 , &dev->vbi_dev.entity,0 ,MEDIA_LNK_FL_ENABLED );#endif }
drivers/media/usb/uvc/uvc_entity.c +1 -1
@@ -56,7 +56,7 @@ static int uvc_mc_register_entity(struct uvc_video_chain *chain,continue ; remote_pad = remote->num_pads -1 ; - ret =media_entity_create_link (source, remote_pad, + ret =media_create_pad_link (source, remote_pad, sink, i, flags);if (ret <0 )return ret;
drivers/staging/media/davinci_vpfe/dm365_ipipeif.c +1 -1
@@ -971,7 +971,7 @@ vpfe_ipipeif_register_entities(struct vpfe_ipipeif_device *ipipeif, ipipeif->video_in.vpfe_dev = vpfe_dev; flags =0 ; - ret =media_entity_create_link (&ipipeif->video_in.video_dev.entity,0 , + ret =media_create_pad_link (&ipipeif->video_in.video_dev.entity,0 , &ipipeif->subdev.entity,0 , flags);if (ret <0 ) goto fail;
drivers/staging/media/davinci_vpfe/dm365_isif.c +1 -1
@@ -1817,7 +1817,7 @@ int vpfe_isif_register_entities(struct vpfe_isif_device *isif, isif->video_out.vpfe_dev = vpfe_dev; flags =0 ;/* connect isif to video node */ - ret =media_entity_create_link (&isif->subdev.entity,1 , + ret =media_create_pad_link (&isif->subdev.entity,1 , &isif->video_out.video_dev.entity,0 , flags);if (ret <0 )
drivers/staging/media/davinci_vpfe/dm365_resizer.c +4 -4
@@ -1831,27 +1831,27 @@ int vpfe_resizer_register_entities(struct vpfe_resizer_device *resizer, resizer->resizer_b.video_out.vpfe_dev = vpfe_dev;/* create link between Resizer Crop----> Resizer A*/ - ret =media_entity_create_link (&resizer->crop_resizer.subdev.entity,1 , + ret =media_create_pad_link (&resizer->crop_resizer.subdev.entity,1 , &resizer->resizer_a.subdev.entity,0 , flags);if (ret <0 ) goto out_create_link;/* create link between Resizer Crop----> Resizer B*/ - ret =media_entity_create_link (&resizer->crop_resizer.subdev.entity,2 , + ret =media_create_pad_link (&resizer->crop_resizer.subdev.entity,2 , &resizer->resizer_b.subdev.entity,0 , flags);if (ret <0 ) goto out_create_link;/* create link between Resizer A ----> video out */ - ret =media_entity_create_link (&resizer->resizer_a.subdev.entity,1 , + ret =media_create_pad_link (&resizer->resizer_a.subdev.entity,1 , &resizer->resizer_a.video_out.video_dev.entity,0 , flags);if (ret <0 ) goto out_create_link;/* create link between Resizer B ----> video out */ - ret =media_entity_create_link (&resizer->resizer_b.subdev.entity,1 , + ret =media_create_pad_link (&resizer->resizer_b.subdev.entity,1 , &resizer->resizer_b.video_out.video_dev.entity,0 , flags);if (ret <0 ) goto out_create_link;
drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c +5 -5
@@ -445,32 +445,32 @@ static int vpfe_register_entities(struct vpfe_device *vpfe_dev)/* if entity has no pads (ex: amplifier), cant establish link */ if (vpfe_dev->sd[i]->entity.num_pads) { - ret =media_entity_create_link (&vpfe_dev->sd[i]->entity, + ret =media_create_pad_link (&vpfe_dev->sd[i]->entity,0 , &vpfe_dev->vpfe_isif.subdev.entity,0 , flags);if (ret <0 ) goto out_resizer_register; } - ret =media_entity_create_link (&vpfe_dev->vpfe_isif.subdev.entity,1 , + ret =media_create_pad_link (&vpfe_dev->vpfe_isif.subdev.entity,1 , &vpfe_dev->vpfe_ipipeif.subdev.entity,0 , flags);if (ret <0 ) goto out_resizer_register; - ret =media_entity_create_link (&vpfe_dev->vpfe_ipipeif.subdev.entity,1 , + ret =media_create_pad_link (&vpfe_dev->vpfe_ipipeif.subdev.entity,1 , &vpfe_dev->vpfe_ipipe.subdev.entity,0 , flags);if (ret <0 ) goto out_resizer_register; - ret =media_entity_create_link (&vpfe_dev->vpfe_ipipe.subdev.entity, + ret =media_create_pad_link (&vpfe_dev->vpfe_ipipe.subdev.entity,1 , &vpfe_dev->vpfe_resizer.crop_resizer.subdev.entity,0 , flags);if (ret <0 ) goto out_resizer_register; - ret =media_entity_create_link (&vpfe_dev->vpfe_ipipeif.subdev.entity,1 , + ret =media_create_pad_link (&vpfe_dev->vpfe_ipipeif.subdev.entity,1 , &vpfe_dev->vpfe_resizer.crop_resizer.subdev.entity,0 , flags);if (ret <0 )
drivers/staging/media/omap4iss/iss.c +6 -6
@@ -1259,7 +1259,7 @@ static int iss_register_entities(struct iss_device *iss) goto done; } - ret =media_entity_create_link (&sensor->entity,0 , input, pad, + ret =media_create_pad_link (&sensor->entity,0 , input, pad, flags);if (ret <0 ) goto done;
@@ -1317,31 +1317,31 @@ static int iss_initialize_modules(struct iss_device *iss) }/* Connect the submodules. */ - ret =media_entity_create_link ( + ret =media_create_pad_link ( &iss->csi2a.subdev.entity,CSI2_PAD_SOURCE , &iss->ipipeif.subdev.entity,IPIPEIF_PAD_SINK ,0 );if (ret <0 ) goto error_link; - ret =media_entity_create_link ( + ret =media_create_pad_link ( &iss->csi2b.subdev.entity,CSI2_PAD_SOURCE , &iss->ipipeif.subdev.entity,IPIPEIF_PAD_SINK ,0 );if (ret <0 ) goto error_link; - ret =media_entity_create_link ( + ret =media_create_pad_link ( &iss->ipipeif.subdev.entity,IPIPEIF_PAD_SOURCE_VP , &iss->resizer.subdev.entity,RESIZER_PAD_SINK ,0 );if (ret <0 ) goto error_link; - ret =media_entity_create_link ( + ret =media_create_pad_link ( &iss->ipipeif.subdev.entity,IPIPEIF_PAD_SOURCE_VP , &iss->ipipe.subdev.entity,IPIPE_PAD_SINK ,0 );if (ret <0 ) goto error_link; - ret =media_entity_create_link ( + ret =media_create_pad_link ( &iss->ipipe.subdev.entity,IPIPE_PAD_SOURCE_VP , &iss->resizer.subdev.entity,RESIZER_PAD_SINK ,0 );if (ret <0 )
drivers/staging/media/omap4iss/iss_csi2.c +1 -1
@@ -1291,7 +1291,7 @@ static int csi2_init_entities(struct iss_csi2_device *csi2, const char *subname) goto error_video;/* Connect the CSI2 subdev to the video node. */ - ret =media_entity_create_link (&csi2->subdev.entity,CSI2_PAD_SOURCE , + ret =media_create_pad_link (&csi2->subdev.entity,CSI2_PAD_SOURCE , &csi2->video_out.video.entity,0 ,0 );if (ret <0 ) goto error_link;
drivers/staging/media/omap4iss/iss_ipipeif.c +1 -1
@@ -762,7 +762,7 @@ static int ipipeif_init_entities(struct iss_ipipeif_device *ipipeif)return ret;/* Connect the IPIPEIF subdev to the video node. */ - ret =media_entity_create_link (&ipipeif->subdev.entity, + ret =media_create_pad_link (&ipipeif->subdev.entity,IPIPEIF_PAD_SOURCE_ISIF_SF , &ipipeif->video_out.video.entity,0 ,0 );if (ret <0 )
drivers/staging/media/omap4iss/iss_resizer.c +1 -1
@@ -806,7 +806,7 @@ static int resizer_init_entities(struct iss_resizer_device *resizer)return ret;/* Connect the RESIZER subdev to the video node. */ - ret =media_entity_create_link (&resizer->subdev.entity, + ret =media_create_pad_link (&resizer->subdev.entity,RESIZER_PAD_SOURCE_MEM , &resizer->video_out.video.entity,0 ,0 );if (ret <0 )
include/media/media-entity.h +1 -1
@@ -208,7 +208,7 @@ int media_entity_init(struct media_entity *entity, u16 num_pads, struct media_pad *pads);void media_entity_cleanup (struct media_entity *entity); -int media_entity_create_link (struct media_entity *source,u16 source_pad, +int media_create_pad_link (struct media_entity *source,u16 source_pad,struct media_entity *sink,u16 sink_pad,u32 flags);void __media_entity_remove_links (struct media_entity *entity);void media_entity_remove_links (struct media_entity *entity);
Signature · 1 line
2.4.3