Skip to contentSkip to conversation

fb: add events for early fb event support.

PATCH In review Inki Dae 2 participants 4 messages Sep 26, 2011 – Oct 4, 2011 Framebuffer layer

lore
Share & tools
lore

Inki Dae

author
#0 lore raw

PATCH v2 2/2 fb: add events for early fb event support.

this patch adds FB_EARLY_EVENT_BLANK and FB_R_EARLY_EVENT_BLANK event mode supports. first, fb_notifier_call_chain() is called with FB_EARLY_EVENT_BLANK and fb_blank() of specific fb driver is called and then fb_notifier_call_chain() is called with FB_EVENT_BLANK again at fb_blank(). and if fb_blank() was failed then fb_nitifier_call_chain() would be called with FB_R_EARLY_EVENT_BLANK to revert the previous effects.

---
 drivers/video/fbmem.c |   21 +++++++++++++++------
 include/linux/fb.h    |    4 ++++
 2 files changed, 19 insertions(+), 6 deletions(-)
drivers/video/fbmem.c +15 -6
index ad93629..a2bd17b 100644
@@ -1032,20 +1032,29 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
 int
 fb_blank(struct fb_info *info, int blank)
 {	
- 	int ret = -EINVAL;
+	struct fb_event event;
+	int ret = -EINVAL, early_ret;
 
  	if (blank > FB_BLANK_POWERDOWN)
  		blank = FB_BLANK_POWERDOWN;
 
+	event.info = info;
+	event.data = ␣
+
+	early_ret = fb_notifier_call_chain(FB_EARLY_EVENT_BLANK, &event);
+
 	if (info->fbops->fb_blank)
  		ret = info->fbops->fb_blank(blank, info);
 
- 	if (!ret) {
-		struct fb_event event;
-
-		event.info = info;
-		event.data = ␣
+	if (!ret)
 		fb_notifier_call_chain(FB_EVENT_BLANK, &event);
+	else {
+		/*
+		 * if fb_blank is failed then revert effects of
+		 * the early blank event.
+		 */
+		if (early_ret < 0)
+			fb_notifier_call_chain(FB_R_EARLY_EVENT_BLANK, &event);
 	}
 
  	return ret;
include/linux/fb.h +4 -0
index 1d6836c..29f53d5 100644
@@ -549,6 +549,10 @@ struct fb_cursor_user {
 #define FB_EVENT_FB_UNBIND              0x0E
 /*      CONSOLE-SPECIFIC: remap all consoles to new fb - for vga switcheroo */
 #define FB_EVENT_REMAP_ALL_CONSOLE      0x0F
+/*      A hardware display blank early change occured */
+#define FB_EARLY_EVENT_BLANK		0x10
+/*      A hardware display blank revert early change occured */
+#define FB_R_EARLY_EVENT_BLANK		0x11
 
 struct fb_event {
 	struct fb_info *info;
Signature · 1 line
1.7.4.1
author
#1 lore raw
Quoted 8 lines

-----Original Message-----
From: Inki Dae [mailto:[email protected]]
Sent: Monday, September 26, 2011 11:37 PM
To: [email protected]; [email protected]
Cc: [email protected]; [email protected]; Inki Dae
Subject: [PATCH v2 2/2] fb: add events for early fb event support.

Quoted 6 lines

this patch adds FB_EARLY_EVENT_BLANK and FB_R_EARLY_EVENT_BLANK event mode supports. first, fb_notifier_call_chain() is called with FB_EARLY_EVENT_BLANK and fb_blank() of specific fb driver is called and then fb_notifier_call_chain() is called with FB_EVENT_BLANK again at fb_blank(). and if fb_blank() was failed then fb_nitifier_call_chain() would be called with FB_R_EARLY_EVENT_BLANK to revert the previous

effects.

Quoted 35 lines
---
 drivers/video/fbmem.c |   21 +++++++++++++++------
 include/linux/fb.h    |    4 ++++
 2 files changed, 19 insertions(+), 6 deletions(-)
drivers/video/fbmem.c +7 -4
index ad93629..a2bd17b 100644
@@ -1032,20 +1032,29 @@ fb_set_var(struct fb_info *info, struct
 fb_var_screeninfo *var)
 int
 fb_blank(struct fb_info *info, int blank)
 {
- 	int ret = -EINVAL;
+	struct fb_event event;
+	int ret = -EINVAL, early_ret;
 
  	if (blank > FB_BLANK_POWERDOWN)
  		blank = FB_BLANK_POWERDOWN;
 
+	event.info = info;
+	event.data = &blank;
+
+	early_ret = fb_notifier_call_chain(FB_EARLY_EVENT_BLANK, &event);
+
 	if (info->fbops->fb_blank)
  		ret = info->fbops->fb_blank(blank, info);
 
- 	if (!ret) {
-		struct fb_event event;
-

drivers/video/fbmem.c fb_set_var(struct fb_info *info, struct · line 1057

Quoted 10 lines
drivers/video/fbmem.c +7 -2
-		event.info = info;
-		event.data = &blank;
+	if (!ret)
 		fb_notifier_call_chain(FB_EVENT_BLANK, &event);
+	else {
+		/*
+		 * if fb_blank is failed then revert effects of
+		 * the early blank event.
+		 */
+		if (early_ret < 0)

Ah, this is condition wrong so I will fix it to "if (!early_ret)".

drivers/video/fbmem.c fb_set_var(struct fb_info *info, struct · line 1058

Quoted 1 line
drivers/video/fbmem.c +1 -0
+			fb_notifier_call_chain(FB_R_EARLY_EVENT_BLANK,

&event);

Quoted 21 lines
drivers/video/fbmem.c +0 -0
 	}
 

return ret;

include/linux/fb.h +0 -0
index 1d6836c..29f53d5 100644
@@ -549,6 +549,10 @@ struct fb_cursor_user {
 #define FB_EVENT_FB_UNBIND              0x0E
 /*      CONSOLE-SPECIFIC: remap all consoles to new fb - for vga

switcheroo */
#define FB_EVENT_REMAP_ALL_CONSOLE 0x0F

include/linux/fb.h +4 -1
+/*      A hardware display blank early change occured */
+#define FB_EARLY_EVENT_BLANK		0x10
+/*      A hardware display blank revert early change occured */
+#define FB_R_EARLY_EVENT_BLANK		0x11
 
 struct fb_event {
 	struct fb_info *info;
--

1.7.4.1

#2 lore raw
In reply to Inki Dae
Quoted 8 lines · Inki Dae
Quoted 8 lines

-----Original Message-----
From: Inki Dae [mailto:[email protected]]
Sent: Monday, September 26, 2011 11:37 PM
To: [email protected]; [email protected]
Cc: [email protected]; [email protected]; Inki Dae
Subject: [PATCH v2 2/2] fb: add events for early fb event support.

Quoted 7 lines
Quoted 6 lines

this patch adds FB_EARLY_EVENT_BLANK and FB_R_EARLY_EVENT_BLANK event mode supports. first, fb_notifier_call_chain() is called with FB_EARLY_EVENT_BLANK and fb_blank() of specific fb driver is called and then fb_notifier_call_chain() is called with FB_EVENT_BLANK again at fb_blank(). and if fb_blank() was failed then fb_nitifier_call_chain() would be called with FB_R_EARLY_EVENT_BLANK to revert the previous

effects.

Is my assumption correct that the framebuffer driver is independent of the specific LCD driver and therefore they can be used independently (at least in theory)? If the answer is yes and there is no direct dependance this looks like the right solution. I could take this patch (or rather the fixed up version when you send it) but I'm unsure how to progress with the LCD part, would be nice to get Richard's Ack on it.

Best regards,

Florian Tobias Schandinat

Quoted 72 lines
Quoted 35 lines
---
 drivers/video/fbmem.c |   21 +++++++++++++++------
 include/linux/fb.h    |    4 ++++
 2 files changed, 19 insertions(+), 6 deletions(-)
drivers/video/fbmem.c +7 -4
index ad93629..a2bd17b 100644
@@ -1032,20 +1032,29 @@ fb_set_var(struct fb_info *info, struct
 fb_var_screeninfo *var)
 int
 fb_blank(struct fb_info *info, int blank)
 {
- 	int ret = -EINVAL;
+	struct fb_event event;
+	int ret = -EINVAL, early_ret;
 
  	if (blank > FB_BLANK_POWERDOWN)
  		blank = FB_BLANK_POWERDOWN;
 
+	event.info = info;
+	event.data = &blank;
+
+	early_ret = fb_notifier_call_chain(FB_EARLY_EVENT_BLANK, &event);
+
 	if (info->fbops->fb_blank)
  		ret = info->fbops->fb_blank(blank, info);
 
- 	if (!ret) {
-		struct fb_event event;
-

drivers/video/fbmem.c fb_set_var(struct fb_info *info, struct · line 1057

Quoted 10 lines
drivers/video/fbmem.c +7 -2
-		event.info = info;
-		event.data = &blank;
+	if (!ret)
 		fb_notifier_call_chain(FB_EVENT_BLANK, &event);
+	else {
+		/*
+		 * if fb_blank is failed then revert effects of
+		 * the early blank event.
+		 */
+		if (early_ret < 0)

Ah, this is condition wrong so I will fix it to "if (!early_ret)".

drivers/video/fbmem.c fb_set_var(struct fb_info *info, struct · line 1058

Quoted 1 line
drivers/video/fbmem.c +1 -0
+			fb_notifier_call_chain(FB_R_EARLY_EVENT_BLANK,

&event);

Quoted 21 lines
drivers/video/fbmem.c +0 -0
 	}
 

return ret;

include/linux/fb.h +0 -0
index 1d6836c..29f53d5 100644
@@ -549,6 +549,10 @@ struct fb_cursor_user {
 #define FB_EVENT_FB_UNBIND              0x0E
 /*      CONSOLE-SPECIFIC: remap all consoles to new fb - for vga

switcheroo */
#define FB_EVENT_REMAP_ALL_CONSOLE 0x0F

include/linux/fb.h +4 -1
+/*      A hardware display blank early change occured */
+#define FB_EARLY_EVENT_BLANK		0x10
+/*      A hardware display blank revert early change occured */
+#define FB_R_EARLY_EVENT_BLANK		0x11
 
 struct fb_event {
 	struct fb_info *info;
--

1.7.4.1

author
#3 lore raw
In reply to Inki Dae
Quoted 22 lines

-----Original Message-----
From: Florian Tobias Schandinat [mailto:[email protected]]
Sent: Sunday, October 02, 2011 9:18 AM
To: Inki Dae
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v2 2/2] fb: add events for early fb event support.

Quoted 8 lines · Inki Dae
Quoted 8 lines

-----Original Message-----
From: Inki Dae [mailto:[email protected]]
Sent: Monday, September 26, 2011 11:37 PM
To: [email protected]; [email protected]
Cc: [email protected]; [email protected]; Inki Dae
Subject: [PATCH v2 2/2] fb: add events for early fb event support.

Quoted 5 lines
Quoted 5 lines

this patch adds FB_EARLY_EVENT_BLANK and FB_R_EARLY_EVENT_BLANK event mode supports. first, fb_notifier_call_chain() is called with FB_EARLY_EVENT_BLANK and fb_blank() of specific fb driver is called and then fb_notifier_call_chain() is called with FB_EVENT_BLANK again at fb_blank(). and if fb_blank() was failed then

Quoted 8 lines

fb_nitifier_call_chain()

Quoted 2 lines
Quoted 1 line

would be called with FB_R_EARLY_EVENT_BLANK to revert the previous

effects.

Is my assumption correct that the framebuffer driver is independent of the specific LCD driver and therefore they can be used independently (at least in
theory)?

Yes, right. they can be used independently.

If the answer is yes and there is no direct dependance this looks

Quoted 8 lines

like
the right solution. I could take this patch (or rather the fixed up version when
you send it) but I'm unsure how to progress with the LCD part, would be nice to
get Richard's Ack on it.

Ok, get it. and I will re-send fixed patch soon. thank you.

Quoted 76 lines

Best regards,

Florian Tobias Schandinat

Quoted 72 lines
Quoted 35 lines
---
 drivers/video/fbmem.c |   21 +++++++++++++++------
 include/linux/fb.h    |    4 ++++
 2 files changed, 19 insertions(+), 6 deletions(-)
drivers/video/fbmem.c +7 -4
index ad93629..a2bd17b 100644
@@ -1032,20 +1032,29 @@ fb_set_var(struct fb_info *info, struct
 fb_var_screeninfo *var)
 int
 fb_blank(struct fb_info *info, int blank)
 {
- 	int ret = -EINVAL;
+	struct fb_event event;
+	int ret = -EINVAL, early_ret;
 
  	if (blank > FB_BLANK_POWERDOWN)
  		blank = FB_BLANK_POWERDOWN;
 
+	event.info = info;
+	event.data = &blank;
+
+	early_ret = fb_notifier_call_chain(FB_EARLY_EVENT_BLANK, &event);
+
 	if (info->fbops->fb_blank)
  		ret = info->fbops->fb_blank(blank, info);
 
- 	if (!ret) {
-		struct fb_event event;
-

drivers/video/fbmem.c fb_set_var(struct fb_info *info, struct · line 1057

Quoted 10 lines
drivers/video/fbmem.c +7 -2
-		event.info = info;
-		event.data = &blank;
+	if (!ret)
 		fb_notifier_call_chain(FB_EVENT_BLANK, &event);
+	else {
+		/*
+		 * if fb_blank is failed then revert effects of
+		 * the early blank event.
+		 */
+		if (early_ret < 0)

Ah, this is condition wrong so I will fix it to "if (!early_ret)".

drivers/video/fbmem.c fb_set_var(struct fb_info *info, struct · line 1058

Quoted 1 line
drivers/video/fbmem.c +1 -0
+			fb_notifier_call_chain(FB_R_EARLY_EVENT_BLANK,

&event);

Quoted 21 lines
drivers/video/fbmem.c +0 -0
 	}
 

return ret;

include/linux/fb.h +0 -0
index 1d6836c..29f53d5 100644
@@ -549,6 +549,10 @@ struct fb_cursor_user {
 #define FB_EVENT_FB_UNBIND              0x0E
 /*      CONSOLE-SPECIFIC: remap all consoles to new fb - for vga

switcheroo */
#define FB_EVENT_REMAP_ALL_CONSOLE 0x0F

include/linux/fb.h +4 -1
+/*      A hardware display blank early change occured */
+#define FB_EARLY_EVENT_BLANK		0x10
+/*      A hardware display blank revert early change occured */
+#define FB_R_EARLY_EVENT_BLANK		0x11
 
 struct fb_event {
 	struct fb_info *info;
--

1.7.4.1