All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [RFC PATCH 1/2] video: add a function to acquire the GraphicDevice of cfb_console
@ 2017-02-07 12:58 Icenowy Zheng
  2017-02-07 12:58 ` [U-Boot] [RFC PATCH 2/2] efi_loader: gop: add support to use cfb_console's framebuffer Icenowy Zheng
  2017-02-10 16:22 ` [U-Boot] [RFC PATCH 1/2] video: add a function to acquire the GraphicDevice of cfb_console Simon Glass
  0 siblings, 2 replies; 6+ messages in thread
From: Icenowy Zheng @ 2017-02-07 12:58 UTC (permalink / raw)
  To: u-boot

Sometimes the GraphicDevice of cfb_console is useful at other place.

Add a function to acquire it, so that the graphics hardware (especially
the framebuffer) can be reused.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
 drivers/video/cfb_console.c | 5 +++++
 include/video_fb.h          | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index c0b1b8dc17..c80ed1646f 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -2199,3 +2199,8 @@ int video_get_screen_columns(void)
 {
 	return CONSOLE_COLS;
 }
+
+GraphicDevice *video_get_graphic_device(void)
+{
+	return pGD;
+};
diff --git a/include/video_fb.h b/include/video_fb.h
index b008853f30..29f2b24648 100644
--- a/include/video_fb.h
+++ b/include/video_fb.h
@@ -89,4 +89,6 @@ void video_set_lut (
     unsigned char b               /* blue */
     );
 
+GraphicDevice *video_get_graphic_device(void);
+
 #endif /*_VIDEO_FB_H_ */
-- 
2.11.0

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

* [U-Boot] [RFC PATCH 2/2] efi_loader: gop: add support to use cfb_console's framebuffer
  2017-02-07 12:58 [U-Boot] [RFC PATCH 1/2] video: add a function to acquire the GraphicDevice of cfb_console Icenowy Zheng
@ 2017-02-07 12:58 ` Icenowy Zheng
  2017-02-08  2:44   ` Bin Meng
  2017-02-10 16:22 ` [U-Boot] [RFC PATCH 1/2] video: add a function to acquire the GraphicDevice of cfb_console Simon Glass
  1 sibling, 1 reply; 6+ messages in thread
From: Icenowy Zheng @ 2017-02-07 12:58 UTC (permalink / raw)
  To: u-boot

As cfb_console now can expose its GraphicDevice, use it in the
implementation of EFI GOP protocol, so that the graphics framebuffer can
be passed to EFI applications.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---

Tested on an Allwinner H3 board with out-of-tree display support.

 cmd/bootefi.c            |  2 +-
 lib/efi_loader/Makefile  |  1 +
 lib/efi_loader/efi_gop.c | 29 ++++++++++++++++++++++++-----
 3 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 97a0fc9c7c..c0636ba5a3 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -210,7 +210,7 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt)
 #ifdef CONFIG_PARTITIONS
 	efi_disk_register();
 #endif
-#ifdef CONFIG_LCD
+#if defined CONFIG_LCD || defined CONFIG_CFB_CONSOLE
 	efi_gop_register();
 #endif
 #ifdef CONFIG_NET
diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
index fa8b91a526..e88c99528c 100644
--- a/lib/efi_loader/Makefile
+++ b/lib/efi_loader/Makefile
@@ -17,6 +17,7 @@ obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o
 obj-y += efi_image_loader.o efi_boottime.o efi_runtime.o efi_console.o
 obj-y += efi_memory.o
 obj-$(CONFIG_LCD) += efi_gop.o
+obj-$(CONFIG_CFB_CONSOLE) += efi_gop.o
 obj-$(CONFIG_PARTITIONS) += efi_disk.o
 obj-$(CONFIG_NET) += efi_net.o
 obj-$(CONFIG_GENERATE_SMBIOS_TABLE) += efi_smbios.o
diff --git a/lib/efi_loader/efi_gop.c b/lib/efi_loader/efi_gop.c
index 286ad83097..86f9aa2d70 100644
--- a/lib/efi_loader/efi_gop.c
+++ b/lib/efi_loader/efi_gop.c
@@ -13,6 +13,7 @@
 #include <lcd.h>
 #include <malloc.h>
 #include <video.h>
+#include <video_fb.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -80,8 +81,10 @@ static efi_status_t EFIAPI gop_blt(struct efi_gop *this, void *buffer,
 	switch (gopobj->bpix) {
 #ifdef CONFIG_DM_VIDEO
 	case VIDEO_BPP32:
-#else
+#elif defined CONFIG_LCD
 	case LCD_COLOR32:
+#elif defined CONFIG_CFB_CONSOLE
+	case GDF_32BIT_X888RGB:
 #endif
 		for (i = 0; i < height; i++) {
 			u32 *dest = fb + ((i + dy)  * line_len32) +
@@ -117,7 +120,7 @@ static efi_status_t EFIAPI gop_blt(struct efi_gop *this, void *buffer,
 
 #ifdef CONFIG_DM_VIDEO
 	video_sync_all();
-#else
+#elif defined CONFIG_LCD
 	lcd_sync();
 #endif
 
@@ -144,7 +147,7 @@ int efi_gop_register(void)
 	row = video_get_ysize(vdev);
 	fb_base = (uintptr_t)priv->fb;
 	fb_size = priv->fb_size;
-#else
+#elif defined CONFIG_LCD
 	int line_len;
 
 	bpix = panel_info.vl_bpix;
@@ -152,15 +155,29 @@ int efi_gop_register(void)
 	row = panel_info.vl_row;
 	fb_base = gd->fb_base;
 	fb_size = lcd_get_size(&line_len);
+#elif defined CONFIG_CFB_CONSOLE
+	GraphicDevice *pGD;
+
+	pGD = video_get_graphic_device();
+	bpix = pGD->gdfIndex;
+	col = pGD->winSizeX;
+	row = pGD->winSizeY;
+	fb_base = pGD->frameAdrs;
+	if (pGD->memSize)
+		fb_size = pGD->memSize;
+	else
+		fb_size = pGD->plnSizeX * row;
 #endif
 
 	switch (bpix) {
 #ifdef CONFIG_DM_VIDEO
 	case VIDEO_BPP16:
 	case VIDEO_BPP32:
-#else
+#elif defined CONFIG_LCD
 	case LCD_COLOR32:
 	case LCD_COLOR16:
+#elif defined CONFIG_CFB_CONSOLE
+	case GDF_32BIT_X888RGB:
 #endif
 		break;
 	default:
@@ -185,8 +202,10 @@ int efi_gop_register(void)
 
 #ifdef CONFIG_DM_VIDEO
 	if (bpix == VIDEO_BPP32) {
-#else
+#elif defined CONFIG_LCD
 	if (bpix == LCD_COLOR32) {
+#elif defined CONFIG_CFB_CONSOLE
+	if (bpix == GDF_32BIT_X888RGB) {
 #endif
 		/* With 32bit color space we can directly expose the fb */
 		gopobj->mode.fb_base = fb_base;
-- 
2.11.0

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

* [U-Boot] [RFC PATCH 2/2] efi_loader: gop: add support to use cfb_console's framebuffer
  2017-02-07 12:58 ` [U-Boot] [RFC PATCH 2/2] efi_loader: gop: add support to use cfb_console's framebuffer Icenowy Zheng
@ 2017-02-08  2:44   ` Bin Meng
  0 siblings, 0 replies; 6+ messages in thread
From: Bin Meng @ 2017-02-08  2:44 UTC (permalink / raw)
  To: u-boot

On Tue, Feb 7, 2017 at 8:58 PM, Icenowy Zheng <icenowy@aosc.xyz> wrote:
> As cfb_console now can expose its GraphicDevice, use it in the
> implementation of EFI GOP protocol, so that the graphics framebuffer can
> be passed to EFI applications.
>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
> ---
>
> Tested on an Allwinner H3 board with out-of-tree display support.
>
>  cmd/bootefi.c            |  2 +-
>  lib/efi_loader/Makefile  |  1 +
>  lib/efi_loader/efi_gop.c | 29 ++++++++++++++++++++++++-----
>  3 files changed, 26 insertions(+), 6 deletions(-)
>

Instead of adding support on legacy CFB console driver, can we use the
DM video driver instead?

Regards,
Bin

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

* [U-Boot] [RFC PATCH 1/2] video: add a function to acquire the GraphicDevice of cfb_console
  2017-02-07 12:58 [U-Boot] [RFC PATCH 1/2] video: add a function to acquire the GraphicDevice of cfb_console Icenowy Zheng
  2017-02-07 12:58 ` [U-Boot] [RFC PATCH 2/2] efi_loader: gop: add support to use cfb_console's framebuffer Icenowy Zheng
@ 2017-02-10 16:22 ` Simon Glass
  1 sibling, 0 replies; 6+ messages in thread
From: Simon Glass @ 2017-02-10 16:22 UTC (permalink / raw)
  To: u-boot

Hi,

On 7 February 2017 at 05:58, Icenowy Zheng <icenowy@aosc.xyz> wrote:
> Sometimes the GraphicDevice of cfb_console is useful at other place.
>
> Add a function to acquire it, so that the graphics hardware (especially
> the framebuffer) can be reused.
>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
> ---
>  drivers/video/cfb_console.c | 5 +++++
>  include/video_fb.h          | 2 ++
>  2 files changed, 7 insertions(+)

Please can you use driver-model video instead.

Regards,
Simon

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

* [U-Boot] [RFC PATCH 2/2] efi_loader: gop: add support to use cfb_console's framebuffer
  2017-02-08  4:50 [U-Boot] [RFC PATCH 2/2] efi_loader: gop: add support to use cfb_console's framebuffer Icenowy Zheng
@ 2017-02-08  5:12 ` Simon Glass
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Glass @ 2017-02-08  5:12 UTC (permalink / raw)
  To: u-boot

Hi,

On 7 February 2017 at 21:50, Icenowy Zheng <icenowy@aosc.xyz> wrote:
>
> 2017?2?8? 10:44? Bin Meng <bmeng.cn@gmail.com>???
>>
>> On Tue, Feb 7, 2017 at 8:58 PM, Icenowy Zheng <icenowy@aosc.xyz> wrote:
>> > As cfb_console now can expose its GraphicDevice, use it in the
>> > implementation of EFI GOP protocol, so that the graphics framebuffer can
>> > be passed to EFI applications.
>> >
>> > Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
>> > ---
>> >
>> > Tested on an Allwinner H3 board with out-of-tree display support.
>> >
>> >  cmd/bootefi.c            |  2 +-
>> >  lib/efi_loader/Makefile  |  1 +
>> >  lib/efi_loader/efi_gop.c | 29 ++++++++++++++++++++++++-----
>> >  3 files changed, 26 insertions(+), 6 deletions(-)
>> >
>>
>> Instead of adding support on legacy CFB console driver, can we use the
>> DM video driver instead?
>
> Many platforms are still using legacy video_hw_init, and may not have the possibility to get ported...

Eventually these boads will be removed if they really don't get
converted. But we should not be adding new features to legacy code.
It's even worse when it is not added to the new code. How would anyone
ever upgrade? The new code becomes a backwater.

So please do this with driver model - ask for help if needed.

Regards,
Simon

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

* [U-Boot] [RFC PATCH 2/2] efi_loader: gop: add support to use cfb_console's framebuffer
@ 2017-02-08  4:50 Icenowy Zheng
  2017-02-08  5:12 ` Simon Glass
  0 siblings, 1 reply; 6+ messages in thread
From: Icenowy Zheng @ 2017-02-08  4:50 UTC (permalink / raw)
  To: u-boot


2017?2?8? 10:44? Bin Meng <bmeng.cn@gmail.com>???
>
> On Tue, Feb 7, 2017 at 8:58 PM, Icenowy Zheng <icenowy@aosc.xyz> wrote: 
> > As cfb_console now can expose its GraphicDevice, use it in the 
> > implementation of EFI GOP protocol, so that the graphics framebuffer can 
> > be passed to EFI applications. 
> > 
> > Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz> 
> > --- 
> > 
> > Tested on an Allwinner H3 board with out-of-tree display support. 
> > 
> >? cmd/bootefi.c??????????? |? 2 +- 
> >? lib/efi_loader/Makefile? |? 1 + 
> >? lib/efi_loader/efi_gop.c | 29 ++++++++++++++++++++++++----- 
> >? 3 files changed, 26 insertions(+), 6 deletions(-) 
> > 
>
> Instead of adding support on legacy CFB console driver, can we use the 
> DM video driver instead? 

Many platforms are still using legacy video_hw_init, and may not have the possibility to get ported...

>
> Regards, 
> Bin 

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

end of thread, other threads:[~2017-02-10 16:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-07 12:58 [U-Boot] [RFC PATCH 1/2] video: add a function to acquire the GraphicDevice of cfb_console Icenowy Zheng
2017-02-07 12:58 ` [U-Boot] [RFC PATCH 2/2] efi_loader: gop: add support to use cfb_console's framebuffer Icenowy Zheng
2017-02-08  2:44   ` Bin Meng
2017-02-10 16:22 ` [U-Boot] [RFC PATCH 1/2] video: add a function to acquire the GraphicDevice of cfb_console Simon Glass
2017-02-08  4:50 [U-Boot] [RFC PATCH 2/2] efi_loader: gop: add support to use cfb_console's framebuffer Icenowy Zheng
2017-02-08  5:12 ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.