All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [Bug 1777672] [NEW] QEMU aarch64 virtual/physical frame buffer
@ 2018-06-19 15:47 David Hoelzer
  2018-07-06 12:39 ` [Qemu-devel] [Bug 1777672] " Peter Maydell
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: David Hoelzer @ 2018-06-19 15:47 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

I fully recognize that the error here could be mine, but the code is
pretty simple and straightforward; When emulating a Raspberry PI 3 using
aarch64 and allocating a virtual framebuffer larger than the physical
frambuffer (for double-buffering purposes), the QEMU window shows the
full size of the *virtual* framebuffer rather than the size of the
*physical* framebuffer.

You can replicate this with code such as:


#define FBWIDTH 1024
#define FBHEIGHT 768

void lfb_init()
{
    uart_puts("Initializing Framebuffer\n");
    mbox[0] = 35*4;
    mbox[1] = MBOX_REQUEST;

    mbox[2] = 0x48003;  //set phy wh
    mbox[3] = 8;
    mbox[4] = 8;
    mbox[5] = FBWIDTH;         //FrameBufferInfo.width
    mbox[6] = FBHEIGHT;          //FrameBufferInfo.height

    mbox[7] = 0x48004;  //set virt wh
    mbox[8] = 8;
    mbox[9] = 8;
    mbox[10] = FBWIDTH;        //FrameBufferInfo.virtual_width
    mbox[11] = FBHEIGHT * 2;         //FrameBufferInfo.virtual_height
    
    mbox[12] = 0x48009; //set virt offset
    mbox[13] = 8;
    mbox[14] = 8;
    mbox[15] = 0;           //FrameBufferInfo.x_offset
    mbox[16] = 0;           //FrameBufferInfo.y.offset
    
    mbox[17] = 0x48005; //set depth
    mbox[18] = 4;
    mbox[19] = 4;
    mbox[20] = 32;          //FrameBufferInfo.depth

    mbox[21] = 0x48006; //set pixel order
    mbox[22] = 4;
    mbox[23] = 4;
    mbox[24] = 1;           //RGB, not BGR preferably

    mbox[25] = 0x40001; //get framebuffer, gets alignment on request
    mbox[26] = 8;
    mbox[27] = 8;
    mbox[28] = 4096;        //FrameBufferInfo.pointer
    mbox[29] = 0;           //FrameBufferInfo.size

    mbox[30] = 0x40008; //get pitch
    mbox[31] = 4;
    mbox[32] = 4;
    mbox[33] = 0;           //FrameBufferInfo.pitch

    mbox[34] = MBOX_TAG_LAST;

    if(mbox_call(MBOX_CH_PROP) && mbox[20]==32 && mbox[28]!=0) {
        mbox[28]&=0x3FFFFFFF;
        fbwidth=mbox[5];
        fbheight=mbox[6];
        pitch=mbox[33];
        lfb=(void*)((unsigned long)mbox[28]);
    }
}

I will assume, for the sake of this posting, that the reader understands
the mailbox architecture and the appropriate address definitions for
them.  The key point is that allocating a virtual buffer twice the
height of the physical buffer results in QEMU improperly displaying a
double-height window.

** Affects: qemu
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1777672

Title:
  QEMU aarch64 virtual/physical frame buffer

Status in QEMU:
  New

Bug description:
  I fully recognize that the error here could be mine, but the code is
  pretty simple and straightforward; When emulating a Raspberry PI 3
  using aarch64 and allocating a virtual framebuffer larger than the
  physical frambuffer (for double-buffering purposes), the QEMU window
  shows the full size of the *virtual* framebuffer rather than the size
  of the *physical* framebuffer.

  You can replicate this with code such as:

  
  #define FBWIDTH 1024
  #define FBHEIGHT 768

  void lfb_init()
  {
      uart_puts("Initializing Framebuffer\n");
      mbox[0] = 35*4;
      mbox[1] = MBOX_REQUEST;

      mbox[2] = 0x48003;  //set phy wh
      mbox[3] = 8;
      mbox[4] = 8;
      mbox[5] = FBWIDTH;         //FrameBufferInfo.width
      mbox[6] = FBHEIGHT;          //FrameBufferInfo.height

      mbox[7] = 0x48004;  //set virt wh
      mbox[8] = 8;
      mbox[9] = 8;
      mbox[10] = FBWIDTH;        //FrameBufferInfo.virtual_width
      mbox[11] = FBHEIGHT * 2;         //FrameBufferInfo.virtual_height
      
      mbox[12] = 0x48009; //set virt offset
      mbox[13] = 8;
      mbox[14] = 8;
      mbox[15] = 0;           //FrameBufferInfo.x_offset
      mbox[16] = 0;           //FrameBufferInfo.y.offset
      
      mbox[17] = 0x48005; //set depth
      mbox[18] = 4;
      mbox[19] = 4;
      mbox[20] = 32;          //FrameBufferInfo.depth

      mbox[21] = 0x48006; //set pixel order
      mbox[22] = 4;
      mbox[23] = 4;
      mbox[24] = 1;           //RGB, not BGR preferably

      mbox[25] = 0x40001; //get framebuffer, gets alignment on request
      mbox[26] = 8;
      mbox[27] = 8;
      mbox[28] = 4096;        //FrameBufferInfo.pointer
      mbox[29] = 0;           //FrameBufferInfo.size

      mbox[30] = 0x40008; //get pitch
      mbox[31] = 4;
      mbox[32] = 4;
      mbox[33] = 0;           //FrameBufferInfo.pitch

      mbox[34] = MBOX_TAG_LAST;

      if(mbox_call(MBOX_CH_PROP) && mbox[20]==32 && mbox[28]!=0) {
          mbox[28]&=0x3FFFFFFF;
          fbwidth=mbox[5];
          fbheight=mbox[6];
          pitch=mbox[33];
          lfb=(void*)((unsigned long)mbox[28]);
      }
  }

  I will assume, for the sake of this posting, that the reader
  understands the mailbox architecture and the appropriate address
  definitions for them.  The key point is that allocating a virtual
  buffer twice the height of the physical buffer results in QEMU
  improperly displaying a double-height window.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1777672/+subscriptions

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

* [Qemu-devel] [Bug 1777672] Re: QEMU aarch64 virtual/physical frame buffer
  2018-06-19 15:47 [Qemu-devel] [Bug 1777672] [NEW] QEMU aarch64 virtual/physical frame buffer David Hoelzer
@ 2018-07-06 12:39 ` Peter Maydell
  2018-07-06 17:37 ` Peter Maydell
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Peter Maydell @ 2018-07-06 12:39 UTC (permalink / raw)
  To: qemu-devel

** Tags added: arm

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1777672

Title:
  QEMU aarch64 virtual/physical frame buffer

Status in QEMU:
  New

Bug description:
  I fully recognize that the error here could be mine, but the code is
  pretty simple and straightforward; When emulating a Raspberry PI 3
  using aarch64 and allocating a virtual framebuffer larger than the
  physical frambuffer (for double-buffering purposes), the QEMU window
  shows the full size of the *virtual* framebuffer rather than the size
  of the *physical* framebuffer.

  You can replicate this with code such as:

  
  #define FBWIDTH 1024
  #define FBHEIGHT 768

  void lfb_init()
  {
      uart_puts("Initializing Framebuffer\n");
      mbox[0] = 35*4;
      mbox[1] = MBOX_REQUEST;

      mbox[2] = 0x48003;  //set phy wh
      mbox[3] = 8;
      mbox[4] = 8;
      mbox[5] = FBWIDTH;         //FrameBufferInfo.width
      mbox[6] = FBHEIGHT;          //FrameBufferInfo.height

      mbox[7] = 0x48004;  //set virt wh
      mbox[8] = 8;
      mbox[9] = 8;
      mbox[10] = FBWIDTH;        //FrameBufferInfo.virtual_width
      mbox[11] = FBHEIGHT * 2;         //FrameBufferInfo.virtual_height
      
      mbox[12] = 0x48009; //set virt offset
      mbox[13] = 8;
      mbox[14] = 8;
      mbox[15] = 0;           //FrameBufferInfo.x_offset
      mbox[16] = 0;           //FrameBufferInfo.y.offset
      
      mbox[17] = 0x48005; //set depth
      mbox[18] = 4;
      mbox[19] = 4;
      mbox[20] = 32;          //FrameBufferInfo.depth

      mbox[21] = 0x48006; //set pixel order
      mbox[22] = 4;
      mbox[23] = 4;
      mbox[24] = 1;           //RGB, not BGR preferably

      mbox[25] = 0x40001; //get framebuffer, gets alignment on request
      mbox[26] = 8;
      mbox[27] = 8;
      mbox[28] = 4096;        //FrameBufferInfo.pointer
      mbox[29] = 0;           //FrameBufferInfo.size

      mbox[30] = 0x40008; //get pitch
      mbox[31] = 4;
      mbox[32] = 4;
      mbox[33] = 0;           //FrameBufferInfo.pitch

      mbox[34] = MBOX_TAG_LAST;

      if(mbox_call(MBOX_CH_PROP) && mbox[20]==32 && mbox[28]!=0) {
          mbox[28]&=0x3FFFFFFF;
          fbwidth=mbox[5];
          fbheight=mbox[6];
          pitch=mbox[33];
          lfb=(void*)((unsigned long)mbox[28]);
      }
  }

  I will assume, for the sake of this posting, that the reader
  understands the mailbox architecture and the appropriate address
  definitions for them.  The key point is that allocating a virtual
  buffer twice the height of the physical buffer results in QEMU
  improperly displaying a double-height window.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1777672/+subscriptions

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

* [Qemu-devel] [Bug 1777672] Re: QEMU aarch64 virtual/physical frame buffer
  2018-06-19 15:47 [Qemu-devel] [Bug 1777672] [NEW] QEMU aarch64 virtual/physical frame buffer David Hoelzer
  2018-07-06 12:39 ` [Qemu-devel] [Bug 1777672] " Peter Maydell
@ 2018-07-06 17:37 ` Peter Maydell
  2018-07-26 20:33 ` David Hoelzer
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Peter Maydell @ 2018-07-06 17:37 UTC (permalink / raw)
  To: qemu-devel

Can you provide a test binary and QEMU command line that reproduce this,
please ?

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1777672

Title:
  QEMU aarch64 virtual/physical frame buffer

Status in QEMU:
  New

Bug description:
  I fully recognize that the error here could be mine, but the code is
  pretty simple and straightforward; When emulating a Raspberry PI 3
  using aarch64 and allocating a virtual framebuffer larger than the
  physical frambuffer (for double-buffering purposes), the QEMU window
  shows the full size of the *virtual* framebuffer rather than the size
  of the *physical* framebuffer.

  You can replicate this with code such as:

  
  #define FBWIDTH 1024
  #define FBHEIGHT 768

  void lfb_init()
  {
      uart_puts("Initializing Framebuffer\n");
      mbox[0] = 35*4;
      mbox[1] = MBOX_REQUEST;

      mbox[2] = 0x48003;  //set phy wh
      mbox[3] = 8;
      mbox[4] = 8;
      mbox[5] = FBWIDTH;         //FrameBufferInfo.width
      mbox[6] = FBHEIGHT;          //FrameBufferInfo.height

      mbox[7] = 0x48004;  //set virt wh
      mbox[8] = 8;
      mbox[9] = 8;
      mbox[10] = FBWIDTH;        //FrameBufferInfo.virtual_width
      mbox[11] = FBHEIGHT * 2;         //FrameBufferInfo.virtual_height
      
      mbox[12] = 0x48009; //set virt offset
      mbox[13] = 8;
      mbox[14] = 8;
      mbox[15] = 0;           //FrameBufferInfo.x_offset
      mbox[16] = 0;           //FrameBufferInfo.y.offset
      
      mbox[17] = 0x48005; //set depth
      mbox[18] = 4;
      mbox[19] = 4;
      mbox[20] = 32;          //FrameBufferInfo.depth

      mbox[21] = 0x48006; //set pixel order
      mbox[22] = 4;
      mbox[23] = 4;
      mbox[24] = 1;           //RGB, not BGR preferably

      mbox[25] = 0x40001; //get framebuffer, gets alignment on request
      mbox[26] = 8;
      mbox[27] = 8;
      mbox[28] = 4096;        //FrameBufferInfo.pointer
      mbox[29] = 0;           //FrameBufferInfo.size

      mbox[30] = 0x40008; //get pitch
      mbox[31] = 4;
      mbox[32] = 4;
      mbox[33] = 0;           //FrameBufferInfo.pitch

      mbox[34] = MBOX_TAG_LAST;

      if(mbox_call(MBOX_CH_PROP) && mbox[20]==32 && mbox[28]!=0) {
          mbox[28]&=0x3FFFFFFF;
          fbwidth=mbox[5];
          fbheight=mbox[6];
          pitch=mbox[33];
          lfb=(void*)((unsigned long)mbox[28]);
      }
  }

  I will assume, for the sake of this posting, that the reader
  understands the mailbox architecture and the appropriate address
  definitions for them.  The key point is that allocating a virtual
  buffer twice the height of the physical buffer results in QEMU
  improperly displaying a double-height window.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1777672/+subscriptions

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

* [Qemu-devel] [Bug 1777672] Re: QEMU aarch64 virtual/physical frame buffer
  2018-06-19 15:47 [Qemu-devel] [Bug 1777672] [NEW] QEMU aarch64 virtual/physical frame buffer David Hoelzer
  2018-07-06 12:39 ` [Qemu-devel] [Bug 1777672] " Peter Maydell
  2018-07-06 17:37 ` Peter Maydell
@ 2018-07-26 20:33 ` David Hoelzer
  2018-07-26 20:34 ` David Hoelzer
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: David Hoelzer @ 2018-07-26 20:33 UTC (permalink / raw)
  To: qemu-devel

Certainly!  Attached.


If you start the attached on a piece of hardware, it will start and display fine.. If you start it in QEMU, it will start but display a double-height screen rather than limiting the physical screen to the specified dimensions.

(The virtual display is double-height in preparation for double
buffering)

** Attachment added: "kernel8.img"
   https://bugs.launchpad.net/qemu/+bug/1777672/+attachment/5168270/+files/kernel8.img

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1777672

Title:
  QEMU aarch64 virtual/physical frame buffer

Status in QEMU:
  New

Bug description:
  I fully recognize that the error here could be mine, but the code is
  pretty simple and straightforward; When emulating a Raspberry PI 3
  using aarch64 and allocating a virtual framebuffer larger than the
  physical frambuffer (for double-buffering purposes), the QEMU window
  shows the full size of the *virtual* framebuffer rather than the size
  of the *physical* framebuffer.

  You can replicate this with code such as:

  
  #define FBWIDTH 1024
  #define FBHEIGHT 768

  void lfb_init()
  {
      uart_puts("Initializing Framebuffer\n");
      mbox[0] = 35*4;
      mbox[1] = MBOX_REQUEST;

      mbox[2] = 0x48003;  //set phy wh
      mbox[3] = 8;
      mbox[4] = 8;
      mbox[5] = FBWIDTH;         //FrameBufferInfo.width
      mbox[6] = FBHEIGHT;          //FrameBufferInfo.height

      mbox[7] = 0x48004;  //set virt wh
      mbox[8] = 8;
      mbox[9] = 8;
      mbox[10] = FBWIDTH;        //FrameBufferInfo.virtual_width
      mbox[11] = FBHEIGHT * 2;         //FrameBufferInfo.virtual_height
      
      mbox[12] = 0x48009; //set virt offset
      mbox[13] = 8;
      mbox[14] = 8;
      mbox[15] = 0;           //FrameBufferInfo.x_offset
      mbox[16] = 0;           //FrameBufferInfo.y.offset
      
      mbox[17] = 0x48005; //set depth
      mbox[18] = 4;
      mbox[19] = 4;
      mbox[20] = 32;          //FrameBufferInfo.depth

      mbox[21] = 0x48006; //set pixel order
      mbox[22] = 4;
      mbox[23] = 4;
      mbox[24] = 1;           //RGB, not BGR preferably

      mbox[25] = 0x40001; //get framebuffer, gets alignment on request
      mbox[26] = 8;
      mbox[27] = 8;
      mbox[28] = 4096;        //FrameBufferInfo.pointer
      mbox[29] = 0;           //FrameBufferInfo.size

      mbox[30] = 0x40008; //get pitch
      mbox[31] = 4;
      mbox[32] = 4;
      mbox[33] = 0;           //FrameBufferInfo.pitch

      mbox[34] = MBOX_TAG_LAST;

      if(mbox_call(MBOX_CH_PROP) && mbox[20]==32 && mbox[28]!=0) {
          mbox[28]&=0x3FFFFFFF;
          fbwidth=mbox[5];
          fbheight=mbox[6];
          pitch=mbox[33];
          lfb=(void*)((unsigned long)mbox[28]);
      }
  }

  I will assume, for the sake of this posting, that the reader
  understands the mailbox architecture and the appropriate address
  definitions for them.  The key point is that allocating a virtual
  buffer twice the height of the physical buffer results in QEMU
  improperly displaying a double-height window.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1777672/+subscriptions

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

* [Qemu-devel] [Bug 1777672] Re: QEMU aarch64 virtual/physical frame buffer
  2018-06-19 15:47 [Qemu-devel] [Bug 1777672] [NEW] QEMU aarch64 virtual/physical frame buffer David Hoelzer
                   ` (2 preceding siblings ...)
  2018-07-26 20:33 ` David Hoelzer
@ 2018-07-26 20:34 ` David Hoelzer
  2018-08-10 12:16 ` Peter Maydell
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: David Hoelzer @ 2018-07-26 20:34 UTC (permalink / raw)
  To: qemu-devel

Whoops.. Forgot to include the QEMU command line:

qemu-system-aarch64 -M raspi3 --kernel kernel8.img -serial stdio

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1777672

Title:
  QEMU aarch64 virtual/physical frame buffer

Status in QEMU:
  New

Bug description:
  I fully recognize that the error here could be mine, but the code is
  pretty simple and straightforward; When emulating a Raspberry PI 3
  using aarch64 and allocating a virtual framebuffer larger than the
  physical frambuffer (for double-buffering purposes), the QEMU window
  shows the full size of the *virtual* framebuffer rather than the size
  of the *physical* framebuffer.

  You can replicate this with code such as:

  
  #define FBWIDTH 1024
  #define FBHEIGHT 768

  void lfb_init()
  {
      uart_puts("Initializing Framebuffer\n");
      mbox[0] = 35*4;
      mbox[1] = MBOX_REQUEST;

      mbox[2] = 0x48003;  //set phy wh
      mbox[3] = 8;
      mbox[4] = 8;
      mbox[5] = FBWIDTH;         //FrameBufferInfo.width
      mbox[6] = FBHEIGHT;          //FrameBufferInfo.height

      mbox[7] = 0x48004;  //set virt wh
      mbox[8] = 8;
      mbox[9] = 8;
      mbox[10] = FBWIDTH;        //FrameBufferInfo.virtual_width
      mbox[11] = FBHEIGHT * 2;         //FrameBufferInfo.virtual_height
      
      mbox[12] = 0x48009; //set virt offset
      mbox[13] = 8;
      mbox[14] = 8;
      mbox[15] = 0;           //FrameBufferInfo.x_offset
      mbox[16] = 0;           //FrameBufferInfo.y.offset
      
      mbox[17] = 0x48005; //set depth
      mbox[18] = 4;
      mbox[19] = 4;
      mbox[20] = 32;          //FrameBufferInfo.depth

      mbox[21] = 0x48006; //set pixel order
      mbox[22] = 4;
      mbox[23] = 4;
      mbox[24] = 1;           //RGB, not BGR preferably

      mbox[25] = 0x40001; //get framebuffer, gets alignment on request
      mbox[26] = 8;
      mbox[27] = 8;
      mbox[28] = 4096;        //FrameBufferInfo.pointer
      mbox[29] = 0;           //FrameBufferInfo.size

      mbox[30] = 0x40008; //get pitch
      mbox[31] = 4;
      mbox[32] = 4;
      mbox[33] = 0;           //FrameBufferInfo.pitch

      mbox[34] = MBOX_TAG_LAST;

      if(mbox_call(MBOX_CH_PROP) && mbox[20]==32 && mbox[28]!=0) {
          mbox[28]&=0x3FFFFFFF;
          fbwidth=mbox[5];
          fbheight=mbox[6];
          pitch=mbox[33];
          lfb=(void*)((unsigned long)mbox[28]);
      }
  }

  I will assume, for the sake of this posting, that the reader
  understands the mailbox architecture and the appropriate address
  definitions for them.  The key point is that allocating a virtual
  buffer twice the height of the physical buffer results in QEMU
  improperly displaying a double-height window.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1777672/+subscriptions

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

* [Qemu-devel] [Bug 1777672] Re: QEMU aarch64 virtual/physical frame buffer
  2018-06-19 15:47 [Qemu-devel] [Bug 1777672] [NEW] QEMU aarch64 virtual/physical frame buffer David Hoelzer
                   ` (3 preceding siblings ...)
  2018-07-26 20:34 ` David Hoelzer
@ 2018-08-10 12:16 ` Peter Maydell
  2018-08-10 17:13 ` David Hoelzer
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Peter Maydell @ 2018-08-10 12:16 UTC (permalink / raw)
  To: qemu-devel

Thanks for the test case. I'm having difficulty matching up your guest
code with the documentation of the fb mbox tags in
https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface
...

Your code sets the physical height to FBHEIGHT via tag 0x48003, and the
virtual height to FBHEIGHT * 2 via tag 0x48004. The documentation in the
wiki link agrees that 48003 is phys w/h and 48004 is virt w/h, but it
says that the physical size is the size of the buffer in memory, and the
virtual size is the size of the viewport sent to the display device, ie
the virtual size should be smaller than the physical, not vice-versa.
Which is correct ?

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1777672

Title:
  QEMU aarch64 virtual/physical frame buffer

Status in QEMU:
  New

Bug description:
  I fully recognize that the error here could be mine, but the code is
  pretty simple and straightforward; When emulating a Raspberry PI 3
  using aarch64 and allocating a virtual framebuffer larger than the
  physical frambuffer (for double-buffering purposes), the QEMU window
  shows the full size of the *virtual* framebuffer rather than the size
  of the *physical* framebuffer.

  You can replicate this with code such as:

  
  #define FBWIDTH 1024
  #define FBHEIGHT 768

  void lfb_init()
  {
      uart_puts("Initializing Framebuffer\n");
      mbox[0] = 35*4;
      mbox[1] = MBOX_REQUEST;

      mbox[2] = 0x48003;  //set phy wh
      mbox[3] = 8;
      mbox[4] = 8;
      mbox[5] = FBWIDTH;         //FrameBufferInfo.width
      mbox[6] = FBHEIGHT;          //FrameBufferInfo.height

      mbox[7] = 0x48004;  //set virt wh
      mbox[8] = 8;
      mbox[9] = 8;
      mbox[10] = FBWIDTH;        //FrameBufferInfo.virtual_width
      mbox[11] = FBHEIGHT * 2;         //FrameBufferInfo.virtual_height
      
      mbox[12] = 0x48009; //set virt offset
      mbox[13] = 8;
      mbox[14] = 8;
      mbox[15] = 0;           //FrameBufferInfo.x_offset
      mbox[16] = 0;           //FrameBufferInfo.y.offset
      
      mbox[17] = 0x48005; //set depth
      mbox[18] = 4;
      mbox[19] = 4;
      mbox[20] = 32;          //FrameBufferInfo.depth

      mbox[21] = 0x48006; //set pixel order
      mbox[22] = 4;
      mbox[23] = 4;
      mbox[24] = 1;           //RGB, not BGR preferably

      mbox[25] = 0x40001; //get framebuffer, gets alignment on request
      mbox[26] = 8;
      mbox[27] = 8;
      mbox[28] = 4096;        //FrameBufferInfo.pointer
      mbox[29] = 0;           //FrameBufferInfo.size

      mbox[30] = 0x40008; //get pitch
      mbox[31] = 4;
      mbox[32] = 4;
      mbox[33] = 0;           //FrameBufferInfo.pitch

      mbox[34] = MBOX_TAG_LAST;

      if(mbox_call(MBOX_CH_PROP) && mbox[20]==32 && mbox[28]!=0) {
          mbox[28]&=0x3FFFFFFF;
          fbwidth=mbox[5];
          fbheight=mbox[6];
          pitch=mbox[33];
          lfb=(void*)((unsigned long)mbox[28]);
      }
  }

  I will assume, for the sake of this posting, that the reader
  understands the mailbox architecture and the appropriate address
  definitions for them.  The key point is that allocating a virtual
  buffer twice the height of the physical buffer results in QEMU
  improperly displaying a double-height window.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1777672/+subscriptions

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

* [Qemu-devel] [Bug 1777672] Re: QEMU aarch64 virtual/physical frame buffer
  2018-06-19 15:47 [Qemu-devel] [Bug 1777672] [NEW] QEMU aarch64 virtual/physical frame buffer David Hoelzer
                   ` (4 preceding siblings ...)
  2018-08-10 12:16 ` Peter Maydell
@ 2018-08-10 17:13 ` David Hoelzer
  2018-08-10 17:38 ` Peter Maydell
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: David Hoelzer @ 2018-08-10 17:13 UTC (permalink / raw)
  To: qemu-devel

The virtual size must be at least the size of the physical display.  One
approach toward double-buffering is to make the virtual height twice the
physical height.  To "flip" the displays you simply change the start of
the visible view port.

See these:

https://lb.raspberrypi.org/forums/viewtopic.php?t=47329
https://www.raspberrypi.org/forums/viewtopic.php?f=67&t=19073&p=324866#p324866

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1777672

Title:
  QEMU aarch64 virtual/physical frame buffer

Status in QEMU:
  New

Bug description:
  I fully recognize that the error here could be mine, but the code is
  pretty simple and straightforward; When emulating a Raspberry PI 3
  using aarch64 and allocating a virtual framebuffer larger than the
  physical frambuffer (for double-buffering purposes), the QEMU window
  shows the full size of the *virtual* framebuffer rather than the size
  of the *physical* framebuffer.

  You can replicate this with code such as:

  
  #define FBWIDTH 1024
  #define FBHEIGHT 768

  void lfb_init()
  {
      uart_puts("Initializing Framebuffer\n");
      mbox[0] = 35*4;
      mbox[1] = MBOX_REQUEST;

      mbox[2] = 0x48003;  //set phy wh
      mbox[3] = 8;
      mbox[4] = 8;
      mbox[5] = FBWIDTH;         //FrameBufferInfo.width
      mbox[6] = FBHEIGHT;          //FrameBufferInfo.height

      mbox[7] = 0x48004;  //set virt wh
      mbox[8] = 8;
      mbox[9] = 8;
      mbox[10] = FBWIDTH;        //FrameBufferInfo.virtual_width
      mbox[11] = FBHEIGHT * 2;         //FrameBufferInfo.virtual_height
      
      mbox[12] = 0x48009; //set virt offset
      mbox[13] = 8;
      mbox[14] = 8;
      mbox[15] = 0;           //FrameBufferInfo.x_offset
      mbox[16] = 0;           //FrameBufferInfo.y.offset
      
      mbox[17] = 0x48005; //set depth
      mbox[18] = 4;
      mbox[19] = 4;
      mbox[20] = 32;          //FrameBufferInfo.depth

      mbox[21] = 0x48006; //set pixel order
      mbox[22] = 4;
      mbox[23] = 4;
      mbox[24] = 1;           //RGB, not BGR preferably

      mbox[25] = 0x40001; //get framebuffer, gets alignment on request
      mbox[26] = 8;
      mbox[27] = 8;
      mbox[28] = 4096;        //FrameBufferInfo.pointer
      mbox[29] = 0;           //FrameBufferInfo.size

      mbox[30] = 0x40008; //get pitch
      mbox[31] = 4;
      mbox[32] = 4;
      mbox[33] = 0;           //FrameBufferInfo.pitch

      mbox[34] = MBOX_TAG_LAST;

      if(mbox_call(MBOX_CH_PROP) && mbox[20]==32 && mbox[28]!=0) {
          mbox[28]&=0x3FFFFFFF;
          fbwidth=mbox[5];
          fbheight=mbox[6];
          pitch=mbox[33];
          lfb=(void*)((unsigned long)mbox[28]);
      }
  }

  I will assume, for the sake of this posting, that the reader
  understands the mailbox architecture and the appropriate address
  definitions for them.  The key point is that allocating a virtual
  buffer twice the height of the physical buffer results in QEMU
  improperly displaying a double-height window.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1777672/+subscriptions

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

* [Qemu-devel] [Bug 1777672] Re: QEMU aarch64 virtual/physical frame buffer
  2018-06-19 15:47 [Qemu-devel] [Bug 1777672] [NEW] QEMU aarch64 virtual/physical frame buffer David Hoelzer
                   ` (5 preceding siblings ...)
  2018-08-10 17:13 ` David Hoelzer
@ 2018-08-10 17:38 ` Peter Maydell
  2018-08-14 15:01 ` Peter Maydell
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Peter Maydell @ 2018-08-10 17:38 UTC (permalink / raw)
  To: qemu-devel

Mmm. I guess the wiki page is just wrong, then. I have some prototype patches that work, but I need to check somehow what the real hardware's response to various edge cases is:
 * trying to set a virtual screen size that's smaller than the physical screen size
 * trying to set the virtual x/y offsets to values that put the physical viewport partially outside the virtual screen (eg setting height = vheight = 480, width = vwidth = 640, xoffset = yoffset = 50)

There's a mechanism in the mbox API for saying "can't do that" but I
don't know whether that sort of thing actually does result in failure to
set the height or the offset or whatever...

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1777672

Title:
  QEMU aarch64 virtual/physical frame buffer

Status in QEMU:
  New

Bug description:
  I fully recognize that the error here could be mine, but the code is
  pretty simple and straightforward; When emulating a Raspberry PI 3
  using aarch64 and allocating a virtual framebuffer larger than the
  physical frambuffer (for double-buffering purposes), the QEMU window
  shows the full size of the *virtual* framebuffer rather than the size
  of the *physical* framebuffer.

  You can replicate this with code such as:

  
  #define FBWIDTH 1024
  #define FBHEIGHT 768

  void lfb_init()
  {
      uart_puts("Initializing Framebuffer\n");
      mbox[0] = 35*4;
      mbox[1] = MBOX_REQUEST;

      mbox[2] = 0x48003;  //set phy wh
      mbox[3] = 8;
      mbox[4] = 8;
      mbox[5] = FBWIDTH;         //FrameBufferInfo.width
      mbox[6] = FBHEIGHT;          //FrameBufferInfo.height

      mbox[7] = 0x48004;  //set virt wh
      mbox[8] = 8;
      mbox[9] = 8;
      mbox[10] = FBWIDTH;        //FrameBufferInfo.virtual_width
      mbox[11] = FBHEIGHT * 2;         //FrameBufferInfo.virtual_height
      
      mbox[12] = 0x48009; //set virt offset
      mbox[13] = 8;
      mbox[14] = 8;
      mbox[15] = 0;           //FrameBufferInfo.x_offset
      mbox[16] = 0;           //FrameBufferInfo.y.offset
      
      mbox[17] = 0x48005; //set depth
      mbox[18] = 4;
      mbox[19] = 4;
      mbox[20] = 32;          //FrameBufferInfo.depth

      mbox[21] = 0x48006; //set pixel order
      mbox[22] = 4;
      mbox[23] = 4;
      mbox[24] = 1;           //RGB, not BGR preferably

      mbox[25] = 0x40001; //get framebuffer, gets alignment on request
      mbox[26] = 8;
      mbox[27] = 8;
      mbox[28] = 4096;        //FrameBufferInfo.pointer
      mbox[29] = 0;           //FrameBufferInfo.size

      mbox[30] = 0x40008; //get pitch
      mbox[31] = 4;
      mbox[32] = 4;
      mbox[33] = 0;           //FrameBufferInfo.pitch

      mbox[34] = MBOX_TAG_LAST;

      if(mbox_call(MBOX_CH_PROP) && mbox[20]==32 && mbox[28]!=0) {
          mbox[28]&=0x3FFFFFFF;
          fbwidth=mbox[5];
          fbheight=mbox[6];
          pitch=mbox[33];
          lfb=(void*)((unsigned long)mbox[28]);
      }
  }

  I will assume, for the sake of this posting, that the reader
  understands the mailbox architecture and the appropriate address
  definitions for them.  The key point is that allocating a virtual
  buffer twice the height of the physical buffer results in QEMU
  improperly displaying a double-height window.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1777672/+subscriptions

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

* [Qemu-devel] [Bug 1777672] Re: QEMU aarch64 virtual/physical frame buffer
  2018-06-19 15:47 [Qemu-devel] [Bug 1777672] [NEW] QEMU aarch64 virtual/physical frame buffer David Hoelzer
                   ` (6 preceding siblings ...)
  2018-08-10 17:38 ` Peter Maydell
@ 2018-08-14 15:01 ` Peter Maydell
  2018-08-24 14:32 ` [Qemu-devel] [Bug 1777672] Re: QEMU raspi virtual/physical frame buffer not implemented Peter Maydell
  2018-12-12  9:42 ` Thomas Huth
  9 siblings, 0 replies; 11+ messages in thread
From: Peter Maydell @ 2018-08-14 15:01 UTC (permalink / raw)
  To: qemu-devel

Just submitted this patchset to the list which should fix this bug:
https://patchwork.ozlabs.org/project/qemu-devel/list/?series=60775


** Changed in: qemu
       Status: New => In Progress

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1777672

Title:
  QEMU aarch64 virtual/physical frame buffer

Status in QEMU:
  In Progress

Bug description:
  I fully recognize that the error here could be mine, but the code is
  pretty simple and straightforward; When emulating a Raspberry PI 3
  using aarch64 and allocating a virtual framebuffer larger than the
  physical frambuffer (for double-buffering purposes), the QEMU window
  shows the full size of the *virtual* framebuffer rather than the size
  of the *physical* framebuffer.

  You can replicate this with code such as:

  
  #define FBWIDTH 1024
  #define FBHEIGHT 768

  void lfb_init()
  {
      uart_puts("Initializing Framebuffer\n");
      mbox[0] = 35*4;
      mbox[1] = MBOX_REQUEST;

      mbox[2] = 0x48003;  //set phy wh
      mbox[3] = 8;
      mbox[4] = 8;
      mbox[5] = FBWIDTH;         //FrameBufferInfo.width
      mbox[6] = FBHEIGHT;          //FrameBufferInfo.height

      mbox[7] = 0x48004;  //set virt wh
      mbox[8] = 8;
      mbox[9] = 8;
      mbox[10] = FBWIDTH;        //FrameBufferInfo.virtual_width
      mbox[11] = FBHEIGHT * 2;         //FrameBufferInfo.virtual_height
      
      mbox[12] = 0x48009; //set virt offset
      mbox[13] = 8;
      mbox[14] = 8;
      mbox[15] = 0;           //FrameBufferInfo.x_offset
      mbox[16] = 0;           //FrameBufferInfo.y.offset
      
      mbox[17] = 0x48005; //set depth
      mbox[18] = 4;
      mbox[19] = 4;
      mbox[20] = 32;          //FrameBufferInfo.depth

      mbox[21] = 0x48006; //set pixel order
      mbox[22] = 4;
      mbox[23] = 4;
      mbox[24] = 1;           //RGB, not BGR preferably

      mbox[25] = 0x40001; //get framebuffer, gets alignment on request
      mbox[26] = 8;
      mbox[27] = 8;
      mbox[28] = 4096;        //FrameBufferInfo.pointer
      mbox[29] = 0;           //FrameBufferInfo.size

      mbox[30] = 0x40008; //get pitch
      mbox[31] = 4;
      mbox[32] = 4;
      mbox[33] = 0;           //FrameBufferInfo.pitch

      mbox[34] = MBOX_TAG_LAST;

      if(mbox_call(MBOX_CH_PROP) && mbox[20]==32 && mbox[28]!=0) {
          mbox[28]&=0x3FFFFFFF;
          fbwidth=mbox[5];
          fbheight=mbox[6];
          pitch=mbox[33];
          lfb=(void*)((unsigned long)mbox[28]);
      }
  }

  I will assume, for the sake of this posting, that the reader
  understands the mailbox architecture and the appropriate address
  definitions for them.  The key point is that allocating a virtual
  buffer twice the height of the physical buffer results in QEMU
  improperly displaying a double-height window.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1777672/+subscriptions

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

* [Qemu-devel] [Bug 1777672] Re: QEMU raspi virtual/physical frame buffer not implemented
  2018-06-19 15:47 [Qemu-devel] [Bug 1777672] [NEW] QEMU aarch64 virtual/physical frame buffer David Hoelzer
                   ` (7 preceding siblings ...)
  2018-08-14 15:01 ` Peter Maydell
@ 2018-08-24 14:32 ` Peter Maydell
  2018-12-12  9:42 ` Thomas Huth
  9 siblings, 0 replies; 11+ messages in thread
From: Peter Maydell @ 2018-08-24 14:32 UTC (permalink / raw)
  To: qemu-devel

This should now be fixed in git master as of commit f4e8428b9a6ea440bb.


** Summary changed:

- QEMU aarch64 virtual/physical frame buffer
+ QEMU raspi virtual/physical frame buffer not implemented

** Changed in: qemu
       Status: In Progress => Fix Committed

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1777672

Title:
  QEMU raspi virtual/physical frame buffer not implemented

Status in QEMU:
  Fix Committed

Bug description:
  I fully recognize that the error here could be mine, but the code is
  pretty simple and straightforward; When emulating a Raspberry PI 3
  using aarch64 and allocating a virtual framebuffer larger than the
  physical frambuffer (for double-buffering purposes), the QEMU window
  shows the full size of the *virtual* framebuffer rather than the size
  of the *physical* framebuffer.

  You can replicate this with code such as:

  
  #define FBWIDTH 1024
  #define FBHEIGHT 768

  void lfb_init()
  {
      uart_puts("Initializing Framebuffer\n");
      mbox[0] = 35*4;
      mbox[1] = MBOX_REQUEST;

      mbox[2] = 0x48003;  //set phy wh
      mbox[3] = 8;
      mbox[4] = 8;
      mbox[5] = FBWIDTH;         //FrameBufferInfo.width
      mbox[6] = FBHEIGHT;          //FrameBufferInfo.height

      mbox[7] = 0x48004;  //set virt wh
      mbox[8] = 8;
      mbox[9] = 8;
      mbox[10] = FBWIDTH;        //FrameBufferInfo.virtual_width
      mbox[11] = FBHEIGHT * 2;         //FrameBufferInfo.virtual_height
      
      mbox[12] = 0x48009; //set virt offset
      mbox[13] = 8;
      mbox[14] = 8;
      mbox[15] = 0;           //FrameBufferInfo.x_offset
      mbox[16] = 0;           //FrameBufferInfo.y.offset
      
      mbox[17] = 0x48005; //set depth
      mbox[18] = 4;
      mbox[19] = 4;
      mbox[20] = 32;          //FrameBufferInfo.depth

      mbox[21] = 0x48006; //set pixel order
      mbox[22] = 4;
      mbox[23] = 4;
      mbox[24] = 1;           //RGB, not BGR preferably

      mbox[25] = 0x40001; //get framebuffer, gets alignment on request
      mbox[26] = 8;
      mbox[27] = 8;
      mbox[28] = 4096;        //FrameBufferInfo.pointer
      mbox[29] = 0;           //FrameBufferInfo.size

      mbox[30] = 0x40008; //get pitch
      mbox[31] = 4;
      mbox[32] = 4;
      mbox[33] = 0;           //FrameBufferInfo.pitch

      mbox[34] = MBOX_TAG_LAST;

      if(mbox_call(MBOX_CH_PROP) && mbox[20]==32 && mbox[28]!=0) {
          mbox[28]&=0x3FFFFFFF;
          fbwidth=mbox[5];
          fbheight=mbox[6];
          pitch=mbox[33];
          lfb=(void*)((unsigned long)mbox[28]);
      }
  }

  I will assume, for the sake of this posting, that the reader
  understands the mailbox architecture and the appropriate address
  definitions for them.  The key point is that allocating a virtual
  buffer twice the height of the physical buffer results in QEMU
  improperly displaying a double-height window.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1777672/+subscriptions

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

* [Qemu-devel] [Bug 1777672] Re: QEMU raspi virtual/physical frame buffer not implemented
  2018-06-19 15:47 [Qemu-devel] [Bug 1777672] [NEW] QEMU aarch64 virtual/physical frame buffer David Hoelzer
                   ` (8 preceding siblings ...)
  2018-08-24 14:32 ` [Qemu-devel] [Bug 1777672] Re: QEMU raspi virtual/physical frame buffer not implemented Peter Maydell
@ 2018-12-12  9:42 ` Thomas Huth
  9 siblings, 0 replies; 11+ messages in thread
From: Thomas Huth @ 2018-12-12  9:42 UTC (permalink / raw)
  To: qemu-devel

** Changed in: qemu
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1777672

Title:
  QEMU raspi virtual/physical frame buffer not implemented

Status in QEMU:
  Fix Released

Bug description:
  I fully recognize that the error here could be mine, but the code is
  pretty simple and straightforward; When emulating a Raspberry PI 3
  using aarch64 and allocating a virtual framebuffer larger than the
  physical frambuffer (for double-buffering purposes), the QEMU window
  shows the full size of the *virtual* framebuffer rather than the size
  of the *physical* framebuffer.

  You can replicate this with code such as:

  
  #define FBWIDTH 1024
  #define FBHEIGHT 768

  void lfb_init()
  {
      uart_puts("Initializing Framebuffer\n");
      mbox[0] = 35*4;
      mbox[1] = MBOX_REQUEST;

      mbox[2] = 0x48003;  //set phy wh
      mbox[3] = 8;
      mbox[4] = 8;
      mbox[5] = FBWIDTH;         //FrameBufferInfo.width
      mbox[6] = FBHEIGHT;          //FrameBufferInfo.height

      mbox[7] = 0x48004;  //set virt wh
      mbox[8] = 8;
      mbox[9] = 8;
      mbox[10] = FBWIDTH;        //FrameBufferInfo.virtual_width
      mbox[11] = FBHEIGHT * 2;         //FrameBufferInfo.virtual_height
      
      mbox[12] = 0x48009; //set virt offset
      mbox[13] = 8;
      mbox[14] = 8;
      mbox[15] = 0;           //FrameBufferInfo.x_offset
      mbox[16] = 0;           //FrameBufferInfo.y.offset
      
      mbox[17] = 0x48005; //set depth
      mbox[18] = 4;
      mbox[19] = 4;
      mbox[20] = 32;          //FrameBufferInfo.depth

      mbox[21] = 0x48006; //set pixel order
      mbox[22] = 4;
      mbox[23] = 4;
      mbox[24] = 1;           //RGB, not BGR preferably

      mbox[25] = 0x40001; //get framebuffer, gets alignment on request
      mbox[26] = 8;
      mbox[27] = 8;
      mbox[28] = 4096;        //FrameBufferInfo.pointer
      mbox[29] = 0;           //FrameBufferInfo.size

      mbox[30] = 0x40008; //get pitch
      mbox[31] = 4;
      mbox[32] = 4;
      mbox[33] = 0;           //FrameBufferInfo.pitch

      mbox[34] = MBOX_TAG_LAST;

      if(mbox_call(MBOX_CH_PROP) && mbox[20]==32 && mbox[28]!=0) {
          mbox[28]&=0x3FFFFFFF;
          fbwidth=mbox[5];
          fbheight=mbox[6];
          pitch=mbox[33];
          lfb=(void*)((unsigned long)mbox[28]);
      }
  }

  I will assume, for the sake of this posting, that the reader
  understands the mailbox architecture and the appropriate address
  definitions for them.  The key point is that allocating a virtual
  buffer twice the height of the physical buffer results in QEMU
  improperly displaying a double-height window.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1777672/+subscriptions

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

end of thread, other threads:[~2018-12-12  9:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-19 15:47 [Qemu-devel] [Bug 1777672] [NEW] QEMU aarch64 virtual/physical frame buffer David Hoelzer
2018-07-06 12:39 ` [Qemu-devel] [Bug 1777672] " Peter Maydell
2018-07-06 17:37 ` Peter Maydell
2018-07-26 20:33 ` David Hoelzer
2018-07-26 20:34 ` David Hoelzer
2018-08-10 12:16 ` Peter Maydell
2018-08-10 17:13 ` David Hoelzer
2018-08-10 17:38 ` Peter Maydell
2018-08-14 15:01 ` Peter Maydell
2018-08-24 14:32 ` [Qemu-devel] [Bug 1777672] Re: QEMU raspi virtual/physical frame buffer not implemented Peter Maydell
2018-12-12  9:42 ` Thomas Huth

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.