All of lore.kernel.org
 help / color / mirror / Atom feed
* [psplash][PATCH 1/2] Allow users to specify a horizontal offset parameter
@ 2019-05-14  0:22 Philipp Schrader
  2019-05-14  0:23 ` [psplash][PATCH 2/2] Add config option to disable fifo Philipp Schrader
  0 siblings, 1 reply; 2+ messages in thread
From: Philipp Schrader @ 2019-05-14  0:22 UTC (permalink / raw)
  To: yocto; +Cc: Philipp Schrader

I have a system where the framebuffer size doesn't match the display
size. In order to figure out which portion of the framebuffer makes it
to the screen I wanted a way to quickly move the picture around. I
decided to add a command line option for a horizontal offset that at
runtime lets you change where exactly the image gets written.

This patch adds a new --horizontal-offset argument to let the user
specify this offset. I was tempted to make the short option "-h"
instead of "-o", but figured that was a bit misleading. "-h" is very
often used for a help.

Signed-off-by: Philipp Schrader <philipp@peloton-tech.com>
---
 psplash.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/psplash.c b/psplash.c
index 992e199..166db73 100644
--- a/psplash.c
+++ b/psplash.c
@@ -206,6 +206,7 @@ main (int argc, char** argv)
 {
   char      *tmpdir;
   int        pipe_fd, i = 0, angle = 0, fbdev_id = 0, ret = 0;
+  int        horizontal_offset = 0;
   PSplashFB *fb;
   bool       disable_console_switch = FALSE;
 
@@ -234,9 +235,16 @@ main (int argc, char** argv)
         continue;
       }
 
+    if (!strcmp(argv[i],"-o") || !strcmp(argv[i],"--horizontal-offset"))
+      {
+        if (++i >= argc) goto fail;
+        horizontal_offset = atoi(argv[i]);
+        continue;
+      }
+
     fail:
       fprintf(stderr, 
-              "Usage: %s [-n|--no-console-switch][-a|--angle <0|90|180|270>][-f|--fbdev <0..9>]\n", 
+              "Usage: %s [-n|--no-console-switch][-a|--angle <0|90|180|270>][-f|--fbdev <0..9>][-o|--horizontal-offset X]\n", 
               argv[0]);
       exit(-1);
   }
@@ -280,7 +288,7 @@ main (int argc, char** argv)
 
   /* Draw the Poky logo  */
   psplash_fb_draw_image (fb, 
-			 (fb->width  - POKY_IMG_WIDTH)/2, 
+			 (fb->width  - POKY_IMG_WIDTH)/2 + horizontal_offset, 
 #if PSPLASH_IMG_FULLSCREEN
 			 (fb->height - POKY_IMG_HEIGHT)/2,
 #else
-- 
2.1.4



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

* [psplash][PATCH 2/2] Add config option to disable fifo
  2019-05-14  0:22 [psplash][PATCH 1/2] Allow users to specify a horizontal offset parameter Philipp Schrader
@ 2019-05-14  0:23 ` Philipp Schrader
  0 siblings, 0 replies; 2+ messages in thread
From: Philipp Schrader @ 2019-05-14  0:23 UTC (permalink / raw)
  To: yocto; +Cc: Philipp Schrader

I have a use case where I want psplash to write its image to the frame
buffer without supporting a progress bar. That means a single write
into the framebuffer. Then it's done.

This patch adds a PSPLASH_ENABLE_CLIENT config option which defaults
to 1 (i.e. true). This keeps the default behaviour the same before and
after this patch. If a user decides to toggle the option then psplash
will not create a fifo in /tmp to listen for messages from
psplash-write. Since psplash won't ever get messages from the client
there is no point in displaying a progress bar either.  The effect is
that psplash will write the image to the framebuffer without a
progress bar and then exit.

Signed-off-by: Philipp Schrader <philipp@peloton-tech.com>
---
 psplash-config.h | 5 +++++
 psplash.c        | 8 ++++++++
 2 files changed, 13 insertions(+)

diff --git a/psplash-config.h b/psplash-config.h
index 82bb76d..ce8645f 100644
--- a/psplash-config.h
+++ b/psplash-config.h
@@ -31,4 +31,9 @@
 /* Position of the image split from top edge, denominator of fraction */
 #define PSPLASH_IMG_SPLIT_DENOMINATOR 6
 
+/* A flag to determine whether psplash listens to psplash-write client.
+ * If disabled, psplash will exit when it's done writing the image into the
+ * framebuffer. The progress bar is also disabled. */
+#define PSPLASH_ENABLE_CLIENT 1
+
 #endif
diff --git a/psplash.c b/psplash.c
index 166db73..64121eb 100644
--- a/psplash.c
+++ b/psplash.c
@@ -256,6 +256,7 @@ main (int argc, char** argv)
 
   chdir(tmpdir);
 
+#if PSPLASH_ENABLE_CLIENT
   if (mkfifo(PSPLASH_FIFO, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP))
     {
       if (errno!=EEXIST) 
@@ -272,6 +273,7 @@ main (int argc, char** argv)
       perror("pipe open");
       exit(-2);
     }
+#endif
 
   if (!disable_console_switch)
     psplash_console_switch ();
@@ -301,6 +303,7 @@ main (int argc, char** argv)
 			 POKY_IMG_ROWSTRIDE,
 			 POKY_IMG_RLE_PIXEL_DATA);
 
+#if PSPLASH_ENABLE_CLIENT
   /* Draw progress bar border */
   psplash_fb_draw_image (fb, 
 			 (fb->width  - BAR_IMG_WIDTH)/2, 
@@ -312,18 +315,23 @@ main (int argc, char** argv)
 			 BAR_IMG_RLE_PIXEL_DATA);
 
   psplash_draw_progress (fb, 0);
+#endif
 
 #ifdef PSPLASH_STARTUP_MSG
   psplash_draw_msg (fb, PSPLASH_STARTUP_MSG);
 #endif
 
+#if PSPLASH_ENABLE_CLIENT
   psplash_main (fb, pipe_fd, 0);
 
 
   psplash_fb_destroy (fb);
+#endif
 
  fb_fail:
+#if PSPLASH_ENABLE_CLIENT
   unlink(PSPLASH_FIFO);
+#endif
 
   if (!disable_console_switch)
     psplash_console_reset ();
-- 
2.1.4



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

end of thread, other threads:[~2019-05-14  0:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-14  0:22 [psplash][PATCH 1/2] Allow users to specify a horizontal offset parameter Philipp Schrader
2019-05-14  0:23 ` [psplash][PATCH 2/2] Add config option to disable fifo Philipp Schrader

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.