dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] drm platform multi-device support
@ 2011-03-29 16:44 Rob Clark
  2011-03-30 12:57 ` Ilija Hadzic
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Rob Clark @ 2011-03-29 16:44 UTC (permalink / raw)
  To: dri-devel

From: Rob Clark <robdclark@gmail.com>

Include the minor device id in the bus-id to give userspace a way to open
the correct "cardN" when there are multiple device instances.
---
It may seem a bit strange to have multiple platform device instances, but
we have a use-case for this.  And this relatively simple patch does the
trick.

 drivers/gpu/drm/drm_ioctl.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index 47db4df..075024b 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -165,14 +165,15 @@ static int drm_set_busid(struct drm_device *dev, struct drm_file *file_priv)
 		drm_unset_busid(dev, master);
 
 	if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) {
-		master->unique_len = 10 + strlen(dev->platformdev->name);
+		master->unique_len = 13 + strlen(dev->platformdev->name);
+		master->unique_size = master->unique_len;
 		master->unique = kmalloc(master->unique_len + 1, GFP_KERNEL);
 
 		if (master->unique == NULL)
 			return -ENOMEM;
 
 		len = snprintf(master->unique, master->unique_len,
-			"platform:%s", dev->platformdev->name);
+			"platform:%s:%02d", dev->platformdev->name, dev->primary->index);
 
 		if (len > master->unique_len) {
 			DRM_ERROR("Unique buffer overflowed\n");
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [RFC] drm platform multi-device support
  2011-03-29 16:44 [RFC] drm platform multi-device support Rob Clark
@ 2011-03-30 12:57 ` Ilija Hadzic
  2011-03-30 14:26   ` Rob Clark
  2011-04-05  0:30 ` Dave Airlie
  2011-07-14  3:12 ` [PATCH] drm: " Rob Clark
  2 siblings, 1 reply; 7+ messages in thread
From: Ilija Hadzic @ 2011-03-30 12:57 UTC (permalink / raw)
  To: Rob Clark; +Cc: dri-devel


Are you by any chance working off a stale branch in git ?

Apparently the lines you are modifying now live in drm_platform_set_busid 
function in drm_platform.c

-- Ilija

On Tue, 29 Mar 2011, Rob Clark wrote:

> From: Rob Clark <robdclark@gmail.com>
>
> Include the minor device id in the bus-id to give userspace a way to open
> the correct "cardN" when there are multiple device instances.
> ---
> It may seem a bit strange to have multiple platform device instances, but
> we have a use-case for this.  And this relatively simple patch does the
> trick.
>
> drivers/gpu/drm/drm_ioctl.c |    5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index 47db4df..075024b 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -165,14 +165,15 @@ static int drm_set_busid(struct drm_device *dev, struct drm_file *file_priv)
> 		drm_unset_busid(dev, master);
>
> 	if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) {
> -		master->unique_len = 10 + strlen(dev->platformdev->name);
> +		master->unique_len = 13 + strlen(dev->platformdev->name);
> +		master->unique_size = master->unique_len;
> 		master->unique = kmalloc(master->unique_len + 1, GFP_KERNEL);
>
> 		if (master->unique == NULL)
> 			return -ENOMEM;
>
> 		len = snprintf(master->unique, master->unique_len,
> -			"platform:%s", dev->platformdev->name);
> +			"platform:%s:%02d", dev->platformdev->name, dev->primary->index);
>
> 		if (len > master->unique_len) {
> 			DRM_ERROR("Unique buffer overflowed\n");
> -- 
> 1.7.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC] drm platform multi-device support
  2011-03-30 12:57 ` Ilija Hadzic
@ 2011-03-30 14:26   ` Rob Clark
  0 siblings, 0 replies; 7+ messages in thread
From: Rob Clark @ 2011-03-30 14:26 UTC (permalink / raw)
  To: Ilija Hadzic; +Cc: dri-devel

Ahh, yes I am..  I apologize, still too much display and gfx accel and
other stuff I depend on isn't in kernel.org tree yet, so I'm just
using ubuntu 2.6.38 tree, ti-omap4 branch, (since this is the most
current kernel that also has everything else I need).  But I guess it
is a bit out of date already.  Maybe there is a way I could pull all
the patches just from drivers/gpu/drm directory to stay a bit more
current?

But anyways, if everyone is ok with the idea to change the bus-id this
way, then I could resubmit a patch with the same change in
drm_platform_set_busid()

BR,
-R

On Wed, Mar 30, 2011 at 7:57 AM, Ilija Hadzic
<ihadzic@research.bell-labs.com> wrote:
>
> Are you by any chance working off a stale branch in git ?
>
> Apparently the lines you are modifying now live in drm_platform_set_busid
> function in drm_platform.c
>
> -- Ilija
>
> On Tue, 29 Mar 2011, Rob Clark wrote:
>
>> From: Rob Clark <robdclark@gmail.com>
>>
>> Include the minor device id in the bus-id to give userspace a way to open
>> the correct "cardN" when there are multiple device instances.
>> ---
>> It may seem a bit strange to have multiple platform device instances, but
>> we have a use-case for this.  And this relatively simple patch does the
>> trick.
>>
>> drivers/gpu/drm/drm_ioctl.c |    5 +++--
>> 1 files changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
>> index 47db4df..075024b 100644
>> --- a/drivers/gpu/drm/drm_ioctl.c
>> +++ b/drivers/gpu/drm/drm_ioctl.c
>> @@ -165,14 +165,15 @@ static int drm_set_busid(struct drm_device *dev,
>> struct drm_file *file_priv)
>>                drm_unset_busid(dev, master);
>>
>>        if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) {
>> -               master->unique_len = 10 + strlen(dev->platformdev->name);
>> +               master->unique_len = 13 + strlen(dev->platformdev->name);
>> +               master->unique_size = master->unique_len;
>>                master->unique = kmalloc(master->unique_len + 1,
>> GFP_KERNEL);
>>
>>                if (master->unique == NULL)
>>                        return -ENOMEM;
>>
>>                len = snprintf(master->unique, master->unique_len,
>> -                       "platform:%s", dev->platformdev->name);
>> +                       "platform:%s:%02d", dev->platformdev->name,
>> dev->primary->index);
>>
>>                if (len > master->unique_len) {
>>                        DRM_ERROR("Unique buffer overflowed\n");
>> --
>> 1.7.1
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC] drm platform multi-device support
  2011-03-29 16:44 [RFC] drm platform multi-device support Rob Clark
  2011-03-30 12:57 ` Ilija Hadzic
@ 2011-04-05  0:30 ` Dave Airlie
  2011-04-05  3:08   ` Rob Clark
  2011-07-14  3:12 ` [PATCH] drm: " Rob Clark
  2 siblings, 1 reply; 7+ messages in thread
From: Dave Airlie @ 2011-04-05  0:30 UTC (permalink / raw)
  To: Rob Clark; +Cc: dri-devel

On Wed, Mar 30, 2011 at 2:44 AM, Rob Clark <rob@ti.com> wrote:
> From: Rob Clark <robdclark@gmail.com>
>
> Include the minor device id in the bus-id to give userspace a way to open
> the correct "cardN" when there are multiple device instances.
> ---
> It may seem a bit strange to have multiple platform device instances, but
> we have a use-case for this.  And this relatively simple patch does the
> trick.

I'm finding it hard to like this since I feel it might limit certain
thing in the future, by baking
this into the ABI.

We have plans for multiple device nodes per device, but they don't
involve abusing the bus id like this.

Surely you'd just have another platform device with another unique
name for this, I'd be more willing
to accept some sort of unique id stored in the platformdev or drm that
isn't the device node.

Dave.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC] drm platform multi-device support
  2011-04-05  0:30 ` Dave Airlie
@ 2011-04-05  3:08   ` Rob Clark
  2011-04-06  1:21     ` Dave Airlie
  0 siblings, 1 reply; 7+ messages in thread
From: Rob Clark @ 2011-04-05  3:08 UTC (permalink / raw)
  To: Dave Airlie; +Cc: dri-devel

On Mon, Apr 4, 2011 at 7:30 PM, Dave Airlie <airlied@gmail.com> wrote:
> On Wed, Mar 30, 2011 at 2:44 AM, Rob Clark <rob@ti.com> wrote:
>> From: Rob Clark <robdclark@gmail.com>
>>
>> Include the minor device id in the bus-id to give userspace a way to open
>> the correct "cardN" when there are multiple device instances.
>> ---
>> It may seem a bit strange to have multiple platform device instances, but
>> we have a use-case for this.  And this relatively simple patch does the
>> trick.
>
> I'm finding it hard to like this since I feel it might limit certain
> thing in the future, by baking
> this into the ABI.
>
> We have plans for multiple device nodes per device, but they don't
> involve abusing the bus id like this.
>
> Surely you'd just have another platform device with another unique
> name for this, I'd be more willing
> to accept some sort of unique id stored in the platformdev or drm that
> isn't the device node.

What about:

		len = snprintf(master->unique, master->unique_len,
			"platform:%s:%02d", dev->platformdev->name, dev->platformdev->id);

(ie. using the id field from struct platform_device)..

Perhaps this is more analogous to using pci bus # / slot / func?

BR,
-R

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC] drm platform multi-device support
  2011-04-05  3:08   ` Rob Clark
@ 2011-04-06  1:21     ` Dave Airlie
  0 siblings, 0 replies; 7+ messages in thread
From: Dave Airlie @ 2011-04-06  1:21 UTC (permalink / raw)
  To: Rob Clark; +Cc: dri-devel

On Tue, Apr 5, 2011 at 1:08 PM, Rob Clark <robdclark@gmail.com> wrote:
> On Mon, Apr 4, 2011 at 7:30 PM, Dave Airlie <airlied@gmail.com> wrote:
>> On Wed, Mar 30, 2011 at 2:44 AM, Rob Clark <rob@ti.com> wrote:
>>> From: Rob Clark <robdclark@gmail.com>
>>>
>>> Include the minor device id in the bus-id to give userspace a way to open
>>> the correct "cardN" when there are multiple device instances.
>>> ---
>>> It may seem a bit strange to have multiple platform device instances, but
>>> we have a use-case for this.  And this relatively simple patch does the
>>> trick.
>>
>> I'm finding it hard to like this since I feel it might limit certain
>> thing in the future, by baking
>> this into the ABI.
>>
>> We have plans for multiple device nodes per device, but they don't
>> involve abusing the bus id like this.
>>
>> Surely you'd just have another platform device with another unique
>> name for this, I'd be more willing
>> to accept some sort of unique id stored in the platformdev or drm that
>> isn't the device node.
>
> What about:
>
>                len = snprintf(master->unique, master->unique_len,
>                        "platform:%s:%02d", dev->platformdev->name, dev->platformdev->id);
>
> (ie. using the id field from struct platform_device)..
>
> Perhaps this is more analogous to using pci bus # / slot / func?

Yup that seems a lot saner and more acceptable.

Dave.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] drm: platform multi-device support
  2011-03-29 16:44 [RFC] drm platform multi-device support Rob Clark
  2011-03-30 12:57 ` Ilija Hadzic
  2011-04-05  0:30 ` Dave Airlie
@ 2011-07-14  3:12 ` Rob Clark
  2 siblings, 0 replies; 7+ messages in thread
From: Rob Clark @ 2011-07-14  3:12 UTC (permalink / raw)
  To: dri-devel; +Cc: Rob Clark

Include the device id in the bus-id to give userspace a way to open
the correct "cardN" when there are multiple device instances.

Signed-off-by: Rob Clark <rob@ti.com>
---
 drivers/gpu/drm/drm_platform.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_platform.c b/drivers/gpu/drm/drm_platform.c
index 7223f06..2a8b626 100644
--- a/drivers/gpu/drm/drm_platform.c
+++ b/drivers/gpu/drm/drm_platform.c
@@ -123,14 +123,15 @@ static int drm_platform_set_busid(struct drm_device *dev, struct drm_master *mas
 {
 	int len, ret;
 
-	master->unique_len = 10 + strlen(dev->platformdev->name);
+	master->unique_len = 13 + strlen(dev->platformdev->name);
+	master->unique_size = master->unique_len;
 	master->unique = kmalloc(master->unique_len + 1, GFP_KERNEL);
 
 	if (master->unique == NULL)
 		return -ENOMEM;
 
 	len = snprintf(master->unique, master->unique_len,
-		       "platform:%s", dev->platformdev->name);
+			"platform:%s:%02d", dev->platformdev->name, dev->platformdev->id);
 
 	if (len > master->unique_len) {
 		DRM_ERROR("Unique buffer overflowed\n");
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-07-14  3:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-29 16:44 [RFC] drm platform multi-device support Rob Clark
2011-03-30 12:57 ` Ilija Hadzic
2011-03-30 14:26   ` Rob Clark
2011-04-05  0:30 ` Dave Airlie
2011-04-05  3:08   ` Rob Clark
2011-04-06  1:21     ` Dave Airlie
2011-07-14  3:12 ` [PATCH] drm: " Rob Clark

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox