[PATCH 1/2] staging: sm750fb: avoid conflicting vesafb

Subsystems: staging - silicon motion sm750 frame buffer driver, staging subsystem, the rest

STALE3362d

13 messages, 4 authors, 2017-06-25 · open the first message on its own page

[PATCH 1/2] staging: sm750fb: avoid conflicting vesafb

From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Date: 2017-06-19 20:33:09

From: Teddy Wang <teddy.wang@siliconmotion.com>

If vesafb is enabled in the config then /dev/fb0 is created by vesa
and this sm750 driver gets fb1, fb2. But we need to be fb0 and fb1 to
effectively work with xorg.
So if it has been alloted fb1, then try to remove the other fb0.

Signed-off-by: Teddy Wang <teddy.wang@siliconmotion.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
 drivers/staging/sm750fb/sm750.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index d5934f3..8199dbe 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -1053,6 +1053,26 @@ static int sm750fb_frambuffer_alloc(struct sm750_dev *sm750_dev, int fbidx)
 	return err;
 }
 
+static int lynxfb_kick_out_firmware_fb(struct pci_dev *pdev)
+{
+	struct apertures_struct *ap;
+	bool primary = false;
+
+	ap = alloc_apertures(1);
+	if (!ap)
+		return -ENOMEM;
+
+	ap->ranges[0].base = pci_resource_start(pdev, 0);
+	ap->ranges[0].size = pci_resource_len(pdev, 0);
+#ifdef CONFIG_X86
+	primary = pdev->resource[PCI_ROM_RESOURCE].flags &
+					IORESOURCE_ROM_SHADOW;
+#endif
+	remove_conflicting_framebuffers(ap, "sm750_fb1", primary);
+	kfree(ap);
+	return 0;
+}
+
 static int lynxfb_pci_probe(struct pci_dev *pdev,
 			    const struct pci_device_id *ent)
 {
@@ -1061,6 +1081,10 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
 	int fbidx;
 	int err;
 
+	err = lynxfb_kick_out_firmware_fb(pdev);
+	if (err)
+		return err;
+
 	/* enable device */
 	err = pcim_enable_device(pdev);
 	if (err)
-- 
1.9.1

[PATCH 2/2] staging: sm750fb: change default screen resolution

From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Date: 2017-06-19 20:33:19

The previous patch which updated screen resolution was tested under
wrong environment. sm750 driver does not support 24bpp. It only
supports 8bpp, 16bpp and 32bpp.
Lets update the default screen resolution to use 32bpp for a better
screen performance.

Fixes: ac669251087d ("staging: sm750fb: change default screen resolution")
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
 drivers/staging/sm750fb/sm750.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 8199dbe..aa26280 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -33,7 +33,7 @@
 static int g_noaccel;
 static int g_nomtrr;
 static const char *g_fbmode[] = {NULL, NULL};
-static const char *g_def_fbmode = "1024x768-24@60";
+static const char *g_def_fbmode = "1024x768-32@60";
 static char *g_settings;
 static int g_dualview;
 static char *g_option;
-- 
1.9.1

Re: [PATCH 1/2] staging: sm750fb: avoid conflicting vesafb

From: Andy Shevchenko <hidden>
Date: 2017-06-19 20:47:23

On Mon, Jun 19, 2017 at 11:32 PM, Sudip Mukherjee
[off-list ref] wrote:

+#ifdef CONFIG_X86
+       primary = pdev->resource[PCI_ROM_RESOURCE].flags &
+                                       IORESOURCE_ROM_SHADOW;
+#endif
Why do we need #ifdef?

In any case you may introduce a temporary variable to have pointer to resource

struct resource *res = &pdev->resource[PCI_ROM_RESOURCE];

-- 
With Best Regards,
Andy Shevchenko

Re: [PATCH 1/2] staging: sm750fb: avoid conflicting vesafb

From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Date: 2017-06-20 20:09:14

On Mon, Jun 19, 2017 at 11:47:20PM +0300, Andy Shevchenko wrote:
On Mon, Jun 19, 2017 at 11:32 PM, Sudip Mukherjee
[off-list ref] wrote:

quoted
+#ifdef CONFIG_X86
+       primary = pdev->resource[PCI_ROM_RESOURCE].flags &
+                                       IORESOURCE_ROM_SHADOW;
+#endif
Why do we need #ifdef?
It has been done in exactly the same way it is done in drm drivers.
All the drm drivers I have checked uses #ifdef.

See for example:
http://elixir.free-electrons.com/linux/v4.12-rc6/source/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c#L470

If you think #ifdef is not required, please send patch for the drm
drivers, and we follow that change here also.
In any case you may introduce a temporary variable to have pointer to resource

struct resource *res = &pdev->resource[PCI_ROM_RESOURCE];
No, we will not want to do it in a different way than the way it is done
by drm drivers.

--
Regards
Sudip

Re: [PATCH 1/2] staging: sm750fb: avoid conflicting vesafb

From: Dan Carpenter <hidden>
Date: 2017-06-20 20:21:10

That's totally bogus.  Just say you don't know.  It's never a
reguirement that people fix AMD drivers before they can review code...

regards,
dan carpenter

Re: [PATCH 1/2] staging: sm750fb: avoid conflicting vesafb

From: Andy Shevchenko <hidden>
Date: 2017-06-20 20:41:02

On Tue, Jun 20, 2017 at 11:20 PM, Dan Carpenter
[off-list ref] wrote:
That's totally bogus.  Just say you don't know.  It's never a
reguirement that people fix AMD drivers before they can review code...
Agree. It's not a cargo cult.
If there any real thing behind that #ifdef  I would like to hear.

-- 
With Best Regards,
Andy Shevchenko

Re: [PATCH 1/2] staging: sm750fb: avoid conflicting vesafb

From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Date: 2017-06-20 20:41:42

Hi Dan,

On Tue, Jun 20, 2017 at 11:20:55PM +0300, Dan Carpenter wrote:
That's totally bogus.  Just say you don't know.  It's never a
reguirement that people fix AMD drivers before they can review code...
Yes, I don't know how drm drivers work, so I blindly follow what has
been done there. And since sm750 ultimately has to be converted to a drm
driver to be taken out of staging, so I will prefer to have similar
changes here.

--
Regards
Sudip

Re: [PATCH 1/2] staging: sm750fb: avoid conflicting vesafb

From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Date: 2017-06-20 20:44:24

On Tue, Jun 20, 2017 at 11:40:59PM +0300, Andy Shevchenko wrote:
On Tue, Jun 20, 2017 at 11:20 PM, Dan Carpenter
[off-list ref] wrote:
quoted
That's totally bogus.  Just say you don't know.  It's never a
reguirement that people fix AMD drivers before they can review code...
Agree. It's not a cargo cult.
If there any real thing behind that #ifdef  I would like to hear.
I dont know the real thing behind that. You can hear the real thing if
you send that patch to drm. And that is the only reason I mentioned that.

--
Regards
Sudip

Re: [PATCH 1/2] staging: sm750fb: avoid conflicting vesafb

From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Date: 2017-06-25 12:43:44

On Mon, Jun 19, 2017 at 09:32:57PM +0100, Sudip Mukherjee wrote:
From: Teddy Wang <teddy.wang@siliconmotion.com>

If vesafb is enabled in the config then /dev/fb0 is created by vesa
and this sm750 driver gets fb1, fb2. But we need to be fb0 and fb1 to
effectively work with xorg.
So if it has been alloted fb1, then try to remove the other fb0.

Signed-off-by: Teddy Wang <teddy.wang@siliconmotion.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
Hi Greg,
You applied the second patch but not this one. Did I miss any review
comments from you about this one?

--
Regards
Sudip

Re: [PATCH 1/2] staging: sm750fb: avoid conflicting vesafb

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: 2017-06-25 12:55:00

On Sun, Jun 25, 2017 at 01:43:34PM +0100, Sudip Mukherjee wrote:
On Mon, Jun 19, 2017 at 09:32:57PM +0100, Sudip Mukherjee wrote:
quoted
From: Teddy Wang <teddy.wang@siliconmotion.com>

If vesafb is enabled in the config then /dev/fb0 is created by vesa
and this sm750 driver gets fb1, fb2. But we need to be fb0 and fb1 to
effectively work with xorg.
So if it has been alloted fb1, then try to remove the other fb0.

Signed-off-by: Teddy Wang <teddy.wang@siliconmotion.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
Hi Greg,
You applied the second patch but not this one. Did I miss any review
comments from you about this one?
All of the other complaints about this patch were not sufficient for me
to justify ignoring it?  Why would I not listen to them?

Please fix and resend if you want it applied.

thanks,

greg k-h

Re: [PATCH 1/2] staging: sm750fb: avoid conflicting vesafb

From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Date: 2017-06-25 13:54:40

On Sun, Jun 25, 2017 at 02:54:51PM +0200, Greg Kroah-Hartman wrote:
On Sun, Jun 25, 2017 at 01:43:34PM +0100, Sudip Mukherjee wrote:
quoted
On Mon, Jun 19, 2017 at 09:32:57PM +0100, Sudip Mukherjee wrote:
quoted
From: Teddy Wang <teddy.wang@siliconmotion.com>

If vesafb is enabled in the config then /dev/fb0 is created by vesa
and this sm750 driver gets fb1, fb2. But we need to be fb0 and fb1 to
effectively work with xorg.
So if it has been alloted fb1, then try to remove the other fb0.

Signed-off-by: Teddy Wang <teddy.wang@siliconmotion.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
Hi Greg,
You applied the second patch but not this one. Did I miss any review
comments from you about this one?
All of the other complaints about this patch were not sufficient for me
to justify ignoring it?  Why would I not listen to them?
This patch is doing what all the drm drivers are doing. So you want
us to do something completely new rather than following the established
practice of a drm driver?

--
Regards
Sudip

Re: [PATCH 1/2] staging: sm750fb: avoid conflicting vesafb

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: 2017-06-25 14:27:31

On Sun, Jun 25, 2017 at 02:54:29PM +0100, Sudip Mukherjee wrote:
On Sun, Jun 25, 2017 at 02:54:51PM +0200, Greg Kroah-Hartman wrote:
quoted
On Sun, Jun 25, 2017 at 01:43:34PM +0100, Sudip Mukherjee wrote:
quoted
On Mon, Jun 19, 2017 at 09:32:57PM +0100, Sudip Mukherjee wrote:
quoted
From: Teddy Wang <teddy.wang@siliconmotion.com>

If vesafb is enabled in the config then /dev/fb0 is created by vesa
and this sm750 driver gets fb1, fb2. But we need to be fb0 and fb1 to
effectively work with xorg.
So if it has been alloted fb1, then try to remove the other fb0.

Signed-off-by: Teddy Wang <teddy.wang@siliconmotion.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
Hi Greg,
You applied the second patch but not this one. Did I miss any review
comments from you about this one?
All of the other complaints about this patch were not sufficient for me
to justify ignoring it?  Why would I not listen to them?
This patch is doing what all the drm drivers are doing. So you want
us to do something completely new rather than following the established
practice of a drm driver?
I despise cargo-cult programming.  You could not answer the "why", so
why would I accept such a patch?

greg k-h

Re: [PATCH 1/2] staging: sm750fb: avoid conflicting vesafb

From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Date: 2017-06-25 15:07:50

On Sun, Jun 25, 2017 at 04:27:23PM +0200, Greg Kroah-Hartman wrote:
On Sun, Jun 25, 2017 at 02:54:29PM +0100, Sudip Mukherjee wrote:
quoted
On Sun, Jun 25, 2017 at 02:54:51PM +0200, Greg Kroah-Hartman wrote:
quoted
On Sun, Jun 25, 2017 at 01:43:34PM +0100, Sudip Mukherjee wrote:
quoted
On Mon, Jun 19, 2017 at 09:32:57PM +0100, Sudip Mukherjee wrote:
quoted
From: Teddy Wang <teddy.wang@siliconmotion.com>

If vesafb is enabled in the config then /dev/fb0 is created by vesa
and this sm750 driver gets fb1, fb2. But we need to be fb0 and fb1 to
effectively work with xorg.
So if it has been alloted fb1, then try to remove the other fb0.

Signed-off-by: Teddy Wang <teddy.wang@siliconmotion.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
Hi Greg,
You applied the second patch but not this one. Did I miss any review
comments from you about this one?
All of the other complaints about this patch were not sufficient for me
to justify ignoring it?  Why would I not listen to them?
This patch is doing what all the drm drivers are doing. So you want
us to do something completely new rather than following the established
practice of a drm driver?
I despise cargo-cult programming.  You could not answer the "why", so
why would I accept such a patch?
Did a quick research into "why".
The patch d8801e4df91e ("x86/PCI: Set IORESOURCE_ROM_SHADOW only for the
default VGA device") has started setting IORESOURCE_ROM_SHADOW in flags
for a default VGA device and that is being done only for x86.
And so, we will need that #ifdef to check IORESOURCE_ROM_SHADOW as that
needs to be checked only for a x86 and not for other arch.

--
Regards
Sudip
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help