[Spice-devel] [PATCH x11spice v2] Changes to build on the 32 bit raspberry pi.
Frediano Ziglio
fziglio at redhat.com
Sat Jun 15 08:03:41 UTC 2019
>
> Signed-off-by: Jeremy White <jwhite at codeweavers.com>
> ---
> v2 Use (u) (u) thing instead of (u) ((u) thing)
> Simplify some casting where possible
> ---
> src/scan.c | 6 +++---
> src/session.c | 8 ++++----
> src/spice.c | 18 +++++++++++-------
> 3 files changed, 18 insertions(+), 14 deletions(-)
>
> diff --git a/src/scan.c b/src/scan.c
> index bb020de..aa10a07 100644
> --- a/src/scan.c
> +++ b/src/scan.c
> @@ -70,7 +70,7 @@ static QXLDrawable *shm_image_to_drawable(spice_t *s,
> shm_image_t *shmi, int x,
> return NULL;
> qxl_image = (QXLImage *) (drawable + 1);
>
> - drawable->release_info.id = (uint64_t) spice_create_release(s,
> RELEASE_SHMI, shmi);
> + drawable->release_info.id = (uintptr_t) spice_create_release(s,
> RELEASE_SHMI, shmi);
> shmi->drawable_ptr = drawable;
>
> drawable->surface_id = 0;
> @@ -91,7 +91,7 @@ static QXLDrawable *shm_image_to_drawable(spice_t *s,
> shm_image_t *shmi, int x,
> drawable->u.copy.src_area.bottom = shmi->h;
> drawable->u.copy.rop_descriptor = SPICE_ROPD_OP_PUT;
>
> - drawable->u.copy.src_bitmap = (QXLPHYSICAL) qxl_image;
> + drawable->u.copy.src_bitmap = (uintptr_t) qxl_image;
>
> qxl_image->descriptor.id = 0;
> qxl_image->descriptor.type = SPICE_IMAGE_TYPE_BITMAP;
> @@ -106,7 +106,7 @@ static QXLDrawable *shm_image_to_drawable(spice_t *s,
> shm_image_t *shmi, int x,
> qxl_image->bitmap.y = shmi->h;
> qxl_image->bitmap.stride = shmi->bytes_per_line;
> qxl_image->bitmap.palette = 0;
> - qxl_image->bitmap.data = (QXLPHYSICAL) shmi->shmaddr;
> + qxl_image->bitmap.data = (uintptr_t) shmi->shmaddr;
>
> return drawable;
> }
> diff --git a/src/session.c b/src/session.c
> index e1b3c00..1e59415 100644
> --- a/src/session.c
> +++ b/src/session.c
> @@ -60,13 +60,13 @@ session_t *global_session = NULL;
> void free_cursor_queue_item(gpointer data)
> {
> QXLCursorCmd *ccmd = (QXLCursorCmd *) data;
> - spice_free_release((spice_release_t *) ccmd->release_info.id);
> + spice_free_release((spice_release_t *) (uintptr_t)
> ccmd->release_info.id);
> }
>
> void free_draw_queue_item(gpointer data)
> {
> QXLDrawable *drawable = (QXLDrawable *) data;
> - spice_free_release((spice_release_t *) drawable->release_info.id);
> + spice_free_release((spice_release_t *) (uintptr_t)
> drawable->release_info.id);
> }
>
> void *session_pop_draw(session_t *session)
> @@ -407,10 +407,10 @@ int session_push_cursor_image(session_t *s,
> ccmd->type = QXL_CURSOR_SET;
> ccmd->u.set.position.x = x + xhot;
> ccmd->u.set.position.y = y + yhot;
> - ccmd->u.set.shape = (QXLPHYSICAL) cursor;
> + ccmd->u.set.shape = (uintptr_t) cursor;
> ccmd->u.set.visible = TRUE;
>
> - ccmd->release_info.id = (uint64_t) spice_create_release(&s->spice,
> RELEASE_MEMORY, ccmd);
> + ccmd->release_info.id = (uintptr_t) spice_create_release(&s->spice,
> RELEASE_MEMORY, ccmd);
>
> g_async_queue_push(s->cursor_queue, ccmd);
> spice_qxl_wakeup(&s->spice.display_sin);
> diff --git a/src/spice.c b/src/spice.c
> index 8489b67..5b95720 100644
> --- a/src/spice.c
> +++ b/src/spice.c
> @@ -33,6 +33,10 @@
> #include <netdb.h>
> #include <spice/macros.h>
>
> +/* Obtain definitions for PRId64 */
Maybe PRIx64, see below
> +#define __STDC_FORMAT_MACROS 1
> +#include <inttypes.h>
> +
> #include "local_spice.h"
> #include "x11spice.h"
> #include "display.h"
> @@ -255,7 +259,7 @@ static int get_command(QXLInstance *qin, struct
> QXLCommandExt *cmd)
> cmd->flags = 0;
> cmd->cmd.type = QXL_CMD_DRAW;
> cmd->cmd.padding = 0;
> - cmd->cmd.data = (QXLPHYSICAL) drawable;
> + cmd->cmd.data = (uintptr_t) drawable;
>
> return 1;
> }
> @@ -273,7 +277,7 @@ static int req_cmd_notification(QXLInstance *qin)
> static void release_resource(QXLInstance *qin G_GNUC_UNUSED,
> struct QXLReleaseInfoExt release_info)
> {
> - spice_free_release((spice_release_t *) release_info.info->id);
> + spice_free_release((spice_release_t *) (uintptr_t)
> release_info.info->id);
> }
>
> static int get_cursor_command(QXLInstance *qin, struct QXLCommandExt *cmd)
> @@ -289,7 +293,7 @@ static int get_cursor_command(QXLInstance *qin, struct
> QXLCommandExt *cmd)
> cmd->flags = 0;
> cmd->cmd.type = QXL_CMD_CURSOR;
> cmd->cmd.padding = 0;
> - cmd->cmd.data = (QXLPHYSICAL) cursor;
> + cmd->cmd.data = (uintptr_t) cursor;
>
> return 1;
> }
> @@ -318,8 +322,8 @@ static int flush_resources(QXLInstance *qin
> G_GNUC_UNUSED)
>
> static void async_complete(QXLInstance *qin G_GNUC_UNUSED, uint64_t cookie)
> {
> - g_debug("%s: cookie 0x%lx", __FUNCTION__, cookie);
> - spice_free_release((spice_release_t *) cookie);
> + g_debug("%s: cookie 0x%"PRId64"x", __FUNCTION__, cookie);
I didn't notice before but I don't think it's what you want.
Say that pointer is 0x12 you will get "0x18x" but I think you want
a "0x12" so possibly you want a
g_debug("%s: cookie 0x%" PRIx64, __FUNCTION__, cookie);
or even better
g_debug("%s: cookie %#" PRIx64, __FUNCTION__, cookie);
> + spice_free_release((spice_release_t *) (uintptr_t) cookie);
> }
>
> static void update_area_complete(QXLInstance *qin G_GNUC_UNUSED,
> @@ -463,7 +467,7 @@ static int send_monitors_config(spice_t *s, int w, int h)
> monitors->heads[0].width = w;
> monitors->heads[0].height = h;
>
> - spice_qxl_monitors_config_async(&s->display_sin, (QXLPHYSICAL) monitors,
> 0, (uint64_t) release);
> + spice_qxl_monitors_config_async(&s->display_sin, (uintptr_t) monitors,
> 0, (uintptr_t) release);
>
> return 0;
> }
> @@ -487,7 +491,7 @@ int spice_create_primary(spice_t *s, int w, int h, int
> bytes_per_line, void *shm
>
> /* TODO - compute this dynamically */
> surface.format = SPICE_SURFACE_FMT_32_xRGB;
> - surface.mem = (QXLPHYSICAL) shmaddr;
> + surface.mem = (uintptr_t) shmaddr;
>
> s->width = w;
> s->height = h;
The rest is fine for me
Frediano
More information about the Spice-devel
mailing list