diff mbox

[U-Boot,08/19] x86: video: Add video driver for bare x86 boards

Message ID 1416023805-9297-9-git-send-email-sjg@chromium.org
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass Nov. 15, 2014, 3:56 a.m. UTC
Add a very simple driver which uses vesa to discover the video mode and
then provides a frame buffer for use by U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/video/Makefile |  1 +
 drivers/video/x86_fb.c | 37 +++++++++++++++++++++++++++++++++++++
 include/video_fb.h     |  2 +-
 3 files changed, 39 insertions(+), 1 deletion(-)
 create mode 100644 drivers/video/x86_fb.c

Comments

Anatolij Gustschin Nov. 15, 2014, 7:26 a.m. UTC | #1
Hi Simon,

On Fri, 14 Nov 2014 20:56:34 -0700
Simon Glass <sjg@chromium.org> wrote:

> Add a very simple driver which uses vesa to discover the video mode and
> then provides a frame buffer for use by U-Boot.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  drivers/video/Makefile |  1 +
>  drivers/video/x86_fb.c | 37 +++++++++++++++++++++++++++++++++++++
>  include/video_fb.h     |  2 +-
>  3 files changed, 39 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/video/x86_fb.c

Acked-by: Anatolij Gustschin <agust@denx.de>

Thanks,

Anatolij
Simon Glass Nov. 25, 2014, 9:49 p.m. UTC | #2
On 15 November 2014 at 00:26, Anatolij Gustschin <agust@denx.de> wrote:
> Hi Simon,
>
> On Fri, 14 Nov 2014 20:56:34 -0700
> Simon Glass <sjg@chromium.org> wrote:
>
>> Add a very simple driver which uses vesa to discover the video mode and
>> then provides a frame buffer for use by U-Boot.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>> ---
>>
>>  drivers/video/Makefile |  1 +
>>  drivers/video/x86_fb.c | 37 +++++++++++++++++++++++++++++++++++++
>>  include/video_fb.h     |  2 +-
>>  3 files changed, 39 insertions(+), 1 deletion(-)
>>  create mode 100644 drivers/video/x86_fb.c
>
> Acked-by: Anatolij Gustschin <agust@denx.de>
>
> Thanks,
>
> Anatolij

I had to move the video_fh.h change to the previous patch to maintain
bisectability.

Applied to u-boot-x86.
diff mbox

Patch

diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 14a6781..000f389 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -41,6 +41,7 @@  obj-$(CONFIG_VIDEO_SM501) += sm501.o
 obj-$(CONFIG_VIDEO_SMI_LYNXEM) += smiLynxEM.o videomodes.o
 obj-$(CONFIG_VIDEO_TEGRA) += tegra.o
 obj-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o
+obj-$(CONFIG_VIDEO_X86) += x86_fb.o
 obj-$(CONFIG_FORMIKE) += formike.o
 obj-$(CONFIG_AM335X_LCD) += am335x-fb.o
 obj-$(CONFIG_VIDEO_PARADE) += parade.o
diff --git a/drivers/video/x86_fb.c b/drivers/video/x86_fb.c
new file mode 100644
index 0000000..8743a8c
--- /dev/null
+++ b/drivers/video/x86_fb.c
@@ -0,0 +1,37 @@ 
+/*
+ *
+ * Vesa frame buffer driver for x86
+ *
+ * Copyright (C) 2014 Google, Inc
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <video_fb.h>
+#include <vbe.h>
+#include "videomodes.h"
+
+/*
+ * The Graphic Device
+ */
+GraphicDevice ctfb;
+
+void *video_hw_init(void)
+{
+	GraphicDevice *gdev = &ctfb;
+	int bits_per_pixel;
+
+	printf("Video: ");
+	if (vbe_get_video_info(gdev)) {
+		printf("No video mode configured\n");
+		return NULL;
+	}
+
+	bits_per_pixel = gdev->gdfBytesPP * 8;
+	sprintf(gdev->modeIdent, "%dx%dx%d", gdev->winSizeX, gdev->winSizeY,
+		bits_per_pixel);
+	printf("%s\n", gdev->modeIdent);
+
+	return (void *)gdev;
+}
diff --git a/include/video_fb.h b/include/video_fb.h
index 6cd4e37..55ec24d 100644
--- a/include/video_fb.h
+++ b/include/video_fb.h
@@ -40,7 +40,7 @@ 
 /* Export Graphic Driver Control                                              */
 /******************************************************************************/
 
-typedef struct {
+typedef struct graphic_device {
     unsigned int isaBase;
     unsigned int pciBase;
     unsigned int dprBase;