Message ID | 20190111140857.4211-16-philmd@redhat.com |
---|---|
State | New |
Headers | show |
Series | typedefs: Remove scarcely used declarations | expand |
On 11/01/19 15:08, Philippe Mathieu-Daudé wrote: > PixelFormat is used by "ui/console.h" and by "ui/qemu-pixman.h". ui/console.h already includes ui/qemu-pixman.h, just move it there? Paolo > Create the new header "ui/pixelformat.h" to declare this structure, > and remove the forward declaration from "qemu/typedefs.h". > > Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> > --- > RFC because "ui/console.h" has on license, so I added a default one.
On 1/11/19 6:32 PM, Paolo Bonzini wrote: > On 11/01/19 15:08, Philippe Mathieu-Daudé wrote: >> PixelFormat is used by "ui/console.h" and by "ui/qemu-pixman.h". > > ui/console.h already includes ui/qemu-pixman.h, just move it there? That was my first though but then noticed pixman seems a bit different/unrelated. If Gerd is OK I will do it. (I should have written that in the commit). > > Paolo > >> Create the new header "ui/pixelformat.h" to declare this structure, >> and remove the forward declaration from "qemu/typedefs.h". >> >> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> >> --- >> RFC because "ui/console.h" has on license, so I added a default one. >
On Mon, Jan 14, 2019 at 11:24:14AM +0100, Philippe Mathieu-Daudé wrote: > On 1/11/19 6:32 PM, Paolo Bonzini wrote: > > On 11/01/19 15:08, Philippe Mathieu-Daudé wrote: > >> PixelFormat is used by "ui/console.h" and by "ui/qemu-pixman.h". > > > > ui/console.h already includes ui/qemu-pixman.h, just move it there? > > That was my first though but then noticed pixman seems a bit > different/unrelated. If Gerd is OK I will do it. (I should have written > that in the commit). console depends on pixman anyway, so that move would be fine. BTW: Should not be that hard to remove PixelFormat altogether, or move the bits which are still needed to vnc which is the only user left (beside deprecated sdl1 which should go away soon). cheers, Gerd
On 1/14/19 1:35 PM, Gerd Hoffmann wrote: > On Mon, Jan 14, 2019 at 11:24:14AM +0100, Philippe Mathieu-Daudé wrote: >> On 1/11/19 6:32 PM, Paolo Bonzini wrote: >>> On 11/01/19 15:08, Philippe Mathieu-Daudé wrote: >>>> PixelFormat is used by "ui/console.h" and by "ui/qemu-pixman.h". >>> >>> ui/console.h already includes ui/qemu-pixman.h, just move it there? >> >> That was my first though but then noticed pixman seems a bit >> different/unrelated. If Gerd is OK I will do it. (I should have written >> that in the commit). > > console depends on pixman anyway, so that move would be fine. Good. > > BTW: Should not be that hard to remove PixelFormat altogether, or move > the bits which are still needed to vnc which is the only user left > (beside deprecated sdl1 which should go away soon). I can help there once SDL1 got removed. Thanks, Phil.
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index af0dc6e065..b0f33aa065 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -67,7 +67,6 @@ typedef struct PCIExpressHost PCIExpressHost; typedef struct PCIHostDeviceAddress PCIHostDeviceAddress; typedef struct PCIHostState PCIHostState; typedef struct PCMachineState PCMachineState; -typedef struct PixelFormat PixelFormat; typedef struct PostcopyDiscardState PostcopyDiscardState; typedef struct Property Property; typedef struct PropertyInfo PropertyInfo; diff --git a/include/ui/console.h b/include/ui/console.h index aa9f975544..4fa2fa5c47 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -2,6 +2,7 @@ #define CONSOLE_H #include "ui/qemu-pixman.h" +#include "ui/pixelformat.h" #include "qom/object.h" #include "qemu/notify.h" #include "qemu/error-report.h" @@ -121,16 +122,6 @@ struct QemuConsoleClass { #define QEMU_ALLOCATED_FLAG 0x01 -struct PixelFormat { - uint8_t bits_per_pixel; - uint8_t bytes_per_pixel; - uint8_t depth; /* color depth in bits */ - uint32_t rmask, gmask, bmask, amask; - uint8_t rshift, gshift, bshift, ashift; - uint8_t rmax, gmax, bmax, amax; - uint8_t rbits, gbits, bbits, abits; -}; - typedef struct DisplaySurface { pixman_format_code_t format; pixman_image_t *image; diff --git a/include/ui/pixelformat.h b/include/ui/pixelformat.h new file mode 100644 index 0000000000..585097531f --- /dev/null +++ b/include/ui/pixelformat.h @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2019 Red Hat, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef QEMU_PIXELFORMAT_H +#define QEMU_PIXELFORMAT_H + +typedef struct PixelFormat { + uint8_t bits_per_pixel; + uint8_t bytes_per_pixel; + uint8_t depth; /* color depth in bits */ + uint32_t rmask, gmask, bmask, amask; + uint8_t rshift, gshift, bshift, ashift; + uint8_t rmax, gmax, bmax, amax; + uint8_t rbits, gbits, bbits, abits; +} PixelFormat; + +#endif diff --git a/include/ui/qemu-pixman.h b/include/ui/qemu-pixman.h index b7c82d17fc..999a4aa770 100644 --- a/include/ui/qemu-pixman.h +++ b/include/ui/qemu-pixman.h @@ -16,6 +16,8 @@ #pragma GCC diagnostic pop #endif +#include "ui/pixelformat.h" + /* * pixman image formats are defined to be native endian, * that means host byte order on qemu. So we go define
PixelFormat is used by "ui/console.h" and by "ui/qemu-pixman.h". Create the new header "ui/pixelformat.h" to declare this structure, and remove the forward declaration from "qemu/typedefs.h". Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> --- RFC because "ui/console.h" has on license, so I added a default one. --- include/qemu/typedefs.h | 1 - include/ui/console.h | 11 +---------- include/ui/pixelformat.h | 31 +++++++++++++++++++++++++++++++ include/ui/qemu-pixman.h | 2 ++ 4 files changed, 34 insertions(+), 11 deletions(-) create mode 100644 include/ui/pixelformat.h