qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org, Anthony Liguori <aliguori@amazon.com>
Subject: Re: [Qemu-devel] [PATCH 2/4] console: add opengl rendering helper functions
Date: Fri, 16 Jan 2015 10:05:28 -0500	[thread overview]
Message-ID: <54B928B8.6080006@redhat.com> (raw)
In-Reply-To: <1421400077.21318.31.camel@nilsson.home.kraxel.org>

On 2015-01-16 at 04:21, Gerd Hoffmann wrote:
>    Hi,
>
>>> +bool console_gl_check_format(DisplayChangeListener *dcl,
>>> +                             pixman_format_code_t format)
>>> +{
>>> +    switch (format) {
>>> +    case PIXMAN_x8r8g8b8:
>>> +    case PIXMAN_a8r8g8b8:
>>> +    case PIXMAN_r5g6b5:
>>> +        return true;
>>> +    default:
>>> +        return false;
>>> +    }
>>> +}
>> What is this function supposed to be used for?
> Inflight change, there is a patch series on the list adding a
> check_format callback to DisplayChangeListenerOps, for format
> negotiation.

OK.

>>> +
>>> +void surface_gl_create_texture(DisplaySurface *surface)
>>> +{
>>> +    switch (surface->format) {
>>> +    case PIXMAN_x8r8g8b8:
>>> +    case PIXMAN_a8r8g8b8:
>>> +        surface->glformat = GL_BGRA;
>> Why does the format code seem to imply ARGB order but you're using the
>> exact opposite? I could imagine something like endianness being the
>> reason, but you're using RGB below where the format code says exactly that.
> endianness indeed.  pixman formats are native endian, so this actually
> is bgra ordering in memory.  While looking at it:  I guess GL_BGRA is
> fixed byte ordering?

Yes, I think so.

> So this probably needs fixing to work correctly on
> bigendian machines ...

Probably, right.

>> Discarding the alpha channel is intentional, I suppose?
> Yes.
>
>>> +                 surface_width(surface),
>>> +                 surface_height(surface),
>>> +                 0, surface->glformat, surface->gltype,
>>> +                 surface_data(surface));
>> Is surface_stride(surface) specified to be surface_width(surface) *
>> bytes_per_pixel (I don't know pixman so I don't know)?
> Usually this is the case, but there can be exceptions.  Hmm, can I
> explicitly pass the stride?

The internet™ tells me about glPixelStorei(GL_UNPACK_ROW_LENGTH, 
$pixels_per_row) and glPixelStorei(GL_UNPACK_ALIGNMENT, 
$row_alignment_in_bytes) (which need to be called before using 
glTexImage2D() or glTexSubImage2D()). You may want to use it for 
surface_gl_update_texture(), too (if that isn't too much work).

Max

  reply	other threads:[~2015-01-16 15:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-12 12:35 [Qemu-devel] [PATCH 0/4] sdl2: add opengl rendering support Gerd Hoffmann
2015-01-12 12:35 ` [Qemu-devel] [PATCH 1/4] configure: opengl overhaul Gerd Hoffmann
2015-01-12 12:55   ` Paolo Bonzini
2015-01-12 13:11     ` Gerd Hoffmann
2015-01-15 19:55   ` Max Reitz
2015-01-16  9:11     ` Gerd Hoffmann
2015-01-12 12:35 ` [Qemu-devel] [PATCH 2/4] console: add opengl rendering helper functions Gerd Hoffmann
2015-01-12 13:04   ` Paolo Bonzini
2015-01-12 13:13     ` Gerd Hoffmann
2015-01-15 20:46   ` Max Reitz
2015-01-16  9:21     ` Gerd Hoffmann
2015-01-16 15:05       ` Max Reitz [this message]
2015-01-12 12:35 ` [Qemu-devel] [PATCH 3/4] sdl2: add support for display rendering using opengl Gerd Hoffmann
2015-01-15 22:14   ` Max Reitz
2015-01-12 12:35 ` [Qemu-devel] [PATCH 4/4] sdl2: move SDL_* includes to sdl2.h Gerd Hoffmann
2015-01-15 22:21   ` Max Reitz

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=54B928B8.6080006@redhat.com \
    --to=mreitz@redhat.com \
    --cc=aliguori@amazon.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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;
as well as URLs for NNTP newsgroup(s).