qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [RfC PATCH 09/12] console: add surface_*() getters
Date: Fri,  1 Mar 2013 10:00:40 +0100	[thread overview]
Message-ID: <1362128443-15687-10-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1362128443-15687-1-git-send-email-kraxel@redhat.com>

Add convinence wrappers to query DisplaySurface properties.
Simliar to ds_get_*, but operating in the DisplaySurface
not the DisplayState.

With this patch in place ui frontents can stop using DisplayState
in the rendering code paths, they can simply operate using the
DisplaySurface passed in via dpy_gfx_switch callback.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 include/ui/console.h |   46 ++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 38 insertions(+), 8 deletions(-)

diff --git a/include/ui/console.h b/include/ui/console.h
index f15a541..ab59e15 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -244,36 +244,66 @@ void dpy_mouse_set(struct DisplayState *s, int x, int y, int on);
 void dpy_cursor_define(struct DisplayState *s, QEMUCursor *cursor);
 bool dpy_cursor_define_supported(struct DisplayState *s);
 
+static inline int surface_stride(DisplaySurface *s)
+{
+    return pixman_image_get_stride(s->image);
+}
+
+static inline void *surface_data(DisplaySurface *s)
+{
+    return pixman_image_get_data(s->image);
+}
+
+static inline int surface_width(DisplaySurface *s)
+{
+    return pixman_image_get_width(s->image);
+}
+
+static inline int surface_height(DisplaySurface *s)
+{
+    return pixman_image_get_height(s->image);
+}
+
+static inline int surface_bits_per_pixel(DisplaySurface *s)
+{
+    int bits = PIXMAN_FORMAT_BPP(s->format);
+    return bits;
+}
+
+static inline int surface_bytes_per_pixel(DisplaySurface *s)
+{
+    int bits = PIXMAN_FORMAT_BPP(s->format);
+    return (bits + 7) / 8;
+}
+
 static inline int ds_get_linesize(DisplayState *ds)
 {
-    return pixman_image_get_stride(ds->surface->image);
+    return surface_stride(ds->surface);
 }
 
 static inline uint8_t* ds_get_data(DisplayState *ds)
 {
-    return (void *)pixman_image_get_data(ds->surface->image);
+    return surface_data(ds->surface);
 }
 
 static inline int ds_get_width(DisplayState *ds)
 {
-    return pixman_image_get_width(ds->surface->image);
+    return surface_width(ds->surface);
 }
 
 static inline int ds_get_height(DisplayState *ds)
 {
-    return pixman_image_get_height(ds->surface->image);
+    return surface_height(ds->surface);
 }
 
 static inline int ds_get_bits_per_pixel(DisplayState *ds)
 {
-    int bits = PIXMAN_FORMAT_BPP(ds->surface->format);
-    return bits;
+    return surface_bits_per_pixel(ds->surface);
 }
 
 static inline int ds_get_bytes_per_pixel(DisplayState *ds)
 {
-    int bits = PIXMAN_FORMAT_BPP(ds->surface->format);
-    return (bits + 7) / 8;
+    return surface_bytes_per_pixel(ds->surface);
 }
 
 static inline pixman_format_code_t ds_get_format(DisplayState *ds)
-- 
1.7.9.7

  parent reply	other threads:[~2013-03-01  9:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-01  9:00 [Qemu-devel] [RfC PATCH 00/12] console/display: cleanup & untangle data structures Gerd Hoffmann
2013-03-01  9:00 ` [Qemu-devel] [RfC PATCH 01/12] console: fix displaychangelisteners interface Gerd Hoffmann
2013-03-01  9:00 ` [Qemu-devel] [RfC PATCH 02/12] console: kill DisplayState->opaque Gerd Hoffmann
2013-03-01  9:00 ` [Qemu-devel] [RfC PATCH 03/12] spice: zap sdpy global Gerd Hoffmann
2013-03-01  9:00 ` [Qemu-devel] [RfC PATCH 04/12] qxl: zap qxl0 global Gerd Hoffmann
2013-03-01  9:00 ` [Qemu-devel] [RfC PATCH 05/12] qxl: better vga init in enter_vga_mode Gerd Hoffmann
2013-03-01  9:00 ` [Qemu-devel] [RfC PATCH 06/12] sdl: drop dead code Gerd Hoffmann
2013-03-01  9:00 ` [Qemu-devel] [RfC PATCH 07/12] console: rework DisplaySurface handling [vga emu side] Gerd Hoffmann
2013-03-01  9:00 ` [Qemu-devel] [RfC PATCH 08/12] console: rework DisplaySurface handling [dcl/ui side] Gerd Hoffmann
2013-03-01  9:00 ` Gerd Hoffmann [this message]
2013-03-01  9:00 ` [Qemu-devel] [RfC PATCH 10/12] gtk: stop using DisplayState Gerd Hoffmann
2013-03-01  9:00 ` [Qemu-devel] [RfC PATCH 11/12] vnc: " Gerd Hoffmann
2013-03-01  9:00 ` [Qemu-devel] [RfC PATCH 12/12] sdl: " Gerd Hoffmann

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=1362128443-15687-10-git-send-email-kraxel@redhat.com \
    --to=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).