public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Igor Grinberg <grinberg@compulab.co.il>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 4/4] common/lcd_console: introduce display/framebuffer rotation
Date: Wed, 18 Mar 2015 17:27:11 +0200	[thread overview]
Message-ID: <5509994F.7060501@compulab.co.il> (raw)
In-Reply-To: <OF09EBE39B.B4D87EC5-ONC1257E0C.0050F39A-C1257E0C.005256F6@br-automation.com>

On 03/18/15 16:59, Hannes Petermaier wrote:
> "U-Boot" <u-boot-bounces@lists.denx.de> schrieb am 18.03.2015 13:56:49:
> 
>>
>> Hi Hannes,
> Hi Igor,
> thanks for response - we come closer to the final solution :-)

Indeed :-)

> 
>>
>>> +}
>>> +
>>> +void __weak lcd_init_console_rot(struct console_t *pcons)
>>> +{
>>> +   return;
>>> +}
>>> +
>>> +void lcd_init_console(void *address, int vl_cols, int vl_rows, int 
> vl_rot)
>>> +{
>>> +   memset(&cons, 0, sizeof(cons));
>>> +   cons.lcd_address = address;
>>> +
>>> +   cons.lcdsizex = vl_cols;
>>> +   cons.lcdsizey = vl_rows;
>>> +   cons.lcdrot = vl_rot;
>>> +
>>> +   cons.fp_putc_xy = &lcd_putc_xy0;
>>> +   cons.fp_console_moverow = &console_moverow0;
>>> +   cons.fp_console_setrow = &console_setrow0;
>>> +   console_calc_rowcol(&cons);
>>
>> I think the above four lines is exactly what should be placed in the
>> __weak variant of lcd_init_console_rot() function (the one just above
>> this one).
> I think not so.
> If the lcd_console_rotation.c is compiled in, the __weak function isn't 
> called anymore.
> And if user wants to have 0 degree rotation, the init-function from 
> lcd_console_rotation.c doesn't anything.
> Therefore it is necessary to initialize these pointers here.

Right. Forgot about the 0 case...

> 
>>> +
>>> +   lcd_init_console_rot(&cons);
>>> +
>>> +   debug("lcd_console: have %d/%d col/rws on scr %dx%d (%d deg 
> rotated)\n",
>>> +         cons.cols, cons.rows, cons.lcdsizex, cons.lcdsizey, vl_rot);
>>> +
>>
>> no need for the empty line here.
> Will be changed in v3.
> 
>>> +
>>> +#include <common.h>
>>> +#include <lcd.h>
>>> +#include <video_font.h>      /* Get font data, width and height */
>>> +
>>> +#if LCD_BPP == LCD_COLOR16
>>> +   #define fbptr_t ushort
>>> +#elif LCD_BPP == LCD_COLOR32
>>> +   #define fbptr_t u32
>>> +#else
>>> +   #define fbptr_t uchar
>>> +#endif
>>
>> That is a duplication of the code in lcd_console.c.
>> If we can get rid of these size games, probably we should have in the 
> lcd.h,
>> or lcd_console.h, or ...
> It might be possible to move this into lcd.h, in every case it is 
> necesarry that common.h
> is included before - from here the information about LCD_BPP is coming.
> I will have a 2nd look to that to avoid this duplication.
> 
>>> +
>>> +void lcd_init_console_rot(struct console_t *pcons)
>>> +{
>>> +   if (pcons->lcdrot == 0) {
>>> +      return;
>>> +   } else if (pcons->lcdrot == 1) {
>>> +      pcons->fp_putc_xy = &lcd_putc_xy90;
>>> +      pcons->fp_console_moverow = &console_moverow90;
>>> +      pcons->fp_console_setrow = &console_setrow90;
>>> +   } else if (pcons->lcdrot == 2) {
>>> +      pcons->fp_putc_xy = &lcd_putc_xy180;
>>> +      pcons->fp_console_moverow = &console_moverow180;
>>> +      pcons->fp_console_setrow = &console_setrow180;
>>> +   } else if (pcons->lcdrot == 3) {
>>> +      pcons->fp_putc_xy = &lcd_putc_xy270;
>>> +      pcons->fp_console_moverow = &console_moverow270;
>>> +      pcons->fp_console_setrow = &console_setrow270;
>>> +   } else {
>>> +      puts("lcd_init_console_rot: invalid framebuffer rotation!\n");
>>
>> How about
>> printf("%s: invalid framebuffer rotation!\n", __func__);
>> ?
> Okay, i will change that.
> Sometime ago, somebody told me on the mailing list that i should prefer 
> the puts function if i don't have to print out some values.

Well, this is no longer true as we have discussed this during the last
U-Boot summit.

> If we want to use the printf we can also printout the given rotation 
> pcons->lcdrot.

Good.


-- 
Regards,
Igor.

      reply	other threads:[~2015-03-18 15:27 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-18  7:37 [U-Boot] [PATCH v2 0/4] common/lcd_console: introduce display/framebuffer rotation Hannes Petermaier
2015-03-18  7:37 ` [U-Boot] [PATCH v2 1/4] common/lcd_console: cleanup lcd_drawchars/lcd_putc_xy Hannes Petermaier
2015-03-19  8:37   ` [U-Boot] [PATCH v3 0/4] common/lcd_console: introduce display/framebuffer rotation Hannes Petermaier
2015-03-19  8:37     ` [U-Boot] [PATCH v3 1/4] common/lcd_console: cleanup lcd_drawchars/lcd_putc_xy Hannes Petermaier
2015-03-19  8:37     ` [U-Boot] [PATCH v3 2/4] common/lcd_console: ask only one-time for bg/fg-color per call Hannes Petermaier
2015-03-19  8:37     ` [U-Boot] [PATCH v3 3/4] common/lcd_console: move single static variables into common (static) structure Hannes Petermaier
2015-03-19  8:37     ` [U-Boot] [PATCH v3 4/4] common/lcd_console: introduce display/framebuffer rotation Hannes Petermaier
2015-03-25 16:24       ` Nikita Kiryanov
2015-03-25 21:24         ` Hannes Petermaier
2015-03-26 16:32           ` Nikita Kiryanov
2015-03-18  7:37 ` [U-Boot] [PATCH v2 2/4] common/lcd_console: ask only one-time for bg/fg-color per call Hannes Petermaier
2015-03-18  7:37 ` [U-Boot] [PATCH v2 3/4] common/lcd_console: move single static variables into common (static) structure Hannes Petermaier
2015-03-18 12:11   ` Igor Grinberg
2015-03-18 12:14     ` Hannes Petermaier
2015-03-18 12:47       ` Igor Grinberg
2015-03-18 15:07         ` Hannes Petermaier
2015-03-18 15:23           ` Igor Grinberg
2015-03-18  7:37 ` [U-Boot] [PATCH v2 4/4] common/lcd_console: introduce display/framebuffer rotation Hannes Petermaier
2015-03-18 12:56   ` Igor Grinberg
2015-03-18 14:59     ` Hannes Petermaier
2015-03-18 15:27       ` Igor Grinberg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5509994F.7060501@compulab.co.il \
    --to=grinberg@compulab.co.il \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox