[PATCH 12/17] ephyr: Remove another host/server split for XV image formats.
Eric Anholt
eric at anholt.net
Mon Aug 26 13:26:18 PDT 2013
---
hw/kdrive/ephyr/ephyrhostvideo.c | 55 -----------------------------------
hw/kdrive/ephyr/ephyrhostvideo.h | 37 -----------------------
hw/kdrive/ephyr/ephyrvideo.c | 63 +++++++++++++++++++++++++++++++++++-----
3 files changed, 56 insertions(+), 99 deletions(-)
diff --git a/hw/kdrive/ephyr/ephyrhostvideo.c b/hw/kdrive/ephyr/ephyrhostvideo.c
index e91cb25..3735f72 100644
--- a/hw/kdrive/ephyr/ephyrhostvideo.c
+++ b/hw/kdrive/ephyr/ephyrhostvideo.c
@@ -44,61 +44,6 @@
#endif /*FALSE*/
Bool
-ephyrHostXVQueryImageFormats(int a_port_id,
- EphyrHostImageFormat ** a_formats,
- int *a_num_format)
-{
- xcb_connection_t *conn = hostx_get_xcbconn();
- xcb_xv_list_image_formats_cookie_t cookie;
- xcb_xv_list_image_formats_reply_t *reply;
- xcb_xv_image_format_info_t *format;
- EphyrHostImageFormat *ephyrFormats;
- int i;
-
- EPHYR_RETURN_VAL_IF_FAIL(a_formats && a_num_format, FALSE);
-
- cookie = xcb_xv_list_image_formats(conn, a_port_id);
- reply = xcb_xv_list_image_formats_reply(conn, cookie, NULL);
- if (!reply)
- return FALSE;
- *a_num_format = reply->num_formats;
- ephyrFormats = calloc(reply->num_formats, sizeof(EphyrHostImageFormat));
- if (!ephyrFormats) {
- free(reply);
- return FALSE;
- }
- format = xcb_xv_list_image_formats_format(reply);
- for (i = 0; i < reply->num_formats; i++) {
- ephyrFormats[i].id = format[i].id;
- ephyrFormats[i].type = format[i].type;
- ephyrFormats[i].byte_order = format[i].byte_order;
- memcpy(ephyrFormats[i].guid, format[i].guid, 16);
- ephyrFormats[i].bits_per_pixel = format[i].bpp;
- ephyrFormats[i].format = format[i].format;
- ephyrFormats[i].num_planes = format[i].num_planes;
- ephyrFormats[i].depth = format[i].depth;
- ephyrFormats[i].red_mask = format[i].red_mask;
- ephyrFormats[i].green_mask = format[i].green_mask;
- ephyrFormats[i].blue_mask = format[i].blue_mask;
- ephyrFormats[i].y_sample_bits = format[i].y_sample_bits;
- ephyrFormats[i].u_sample_bits = format[i].u_sample_bits;
- ephyrFormats[i].v_sample_bits = format[i].v_sample_bits;
- ephyrFormats[i].horz_y_period = format[i].vhorz_y_period;
- ephyrFormats[i].horz_u_period = format[i].vhorz_u_period;
- ephyrFormats[i].horz_v_period = format[i].vhorz_v_period;
- ephyrFormats[i].vert_y_period = format[i].vvert_y_period;
- ephyrFormats[i].vert_u_period = format[i].vvert_u_period;
- ephyrFormats[i].vert_v_period = format[i].vvert_v_period;
- memcpy(ephyrFormats[i].component_order, format[i].vcomp_order, 32);
- ephyrFormats[i].scanline_order = format[i].vscanline_order;
- }
- *a_formats = ephyrFormats;
-
- free(reply);
- return TRUE;
-}
-
-Bool
ephyrHostXVQueryBestSize(int a_port_id,
Bool a_motion,
unsigned int a_frame_w,
diff --git a/hw/kdrive/ephyr/ephyrhostvideo.h b/hw/kdrive/ephyr/ephyrhostvideo.h
index 0c1f1da..080caa8 100644
--- a/hw/kdrive/ephyr/ephyrhostvideo.h
+++ b/hw/kdrive/ephyr/ephyrhostvideo.h
@@ -31,48 +31,11 @@
#include <xcb/xv.h>
#include <X11/Xdefs.h>
-typedef struct _EphyrHostImageFormat {
- int id; /* Unique descriptor for the format */
- int type; /* XvRGB, XvYUV */
- int byte_order; /* LSBFirst, MSBFirst */
- char guid[16]; /* Globally Unique IDentifier */
- int bits_per_pixel;
- int format; /* XvPacked, XvPlanar */
- int num_planes;
-
- /* for RGB formats only */
- int depth;
- unsigned int red_mask;
- unsigned int green_mask;
- unsigned int blue_mask;
-
- /* for YUV formats only */
- unsigned int y_sample_bits;
- unsigned int u_sample_bits;
- unsigned int v_sample_bits;
- unsigned int horz_y_period;
- unsigned int horz_u_period;
- unsigned int horz_v_period;
- unsigned int vert_y_period;
- unsigned int vert_u_period;
- unsigned int vert_v_period;
- char component_order[32]; /* eg. UYVY */
- int scanline_order; /* XvTopToBottom, XvBottomToTop */
-} EphyrHostImageFormat;
-
typedef struct {
unsigned short x1, y1, x2, y2;
} EphyrHostBox;
/*
- * image format
- */
-
-Bool ephyrHostXVQueryImageFormats(int a_port_id,
- EphyrHostImageFormat ** a_formats,
- int *a_num_format);
-
-/*
*size query
*/
Bool ephyrHostXVQueryBestSize(int a_port_id,
diff --git a/hw/kdrive/ephyr/ephyrvideo.c b/hw/kdrive/ephyr/ephyrvideo.c
index 1a16c5d..0795353 100644
--- a/hw/kdrive/ephyr/ephyrvideo.c
+++ b/hw/kdrive/ephyr/ephyrvideo.c
@@ -420,13 +420,65 @@ translate_xv_attributes(KdVideoAdaptorPtr adaptor,
}
static Bool
+translate_xv_image_formats(KdVideoAdaptorPtr adaptor,
+ xcb_xv_adaptor_info_t *host_adaptor)
+{
+ xcb_connection_t *conn = hostx_get_xcbconn();
+ int i = 0;
+ xcb_xv_list_image_formats_cookie_t cookie =
+ xcb_xv_list_image_formats(conn, host_adaptor->base_id);
+ xcb_xv_list_image_formats_reply_t *reply =
+ xcb_xv_list_image_formats_reply(conn, cookie, NULL);
+ xcb_xv_image_format_info_t *formats;
+
+ if (!reply)
+ return FALSE;
+
+ adaptor->nImages = reply->num_formats;
+ adaptor->pImages = calloc(reply->num_formats, sizeof(KdImageRec));
+ if (!adaptor->pImages) {
+ free(reply);
+ return FALSE;
+ }
+
+ formats = xcb_xv_list_image_formats_format(reply);
+ for (i = 0; i < reply->num_formats; i++) {
+ KdImagePtr image = &adaptor->pImages[i];
+
+ image->id = formats[i].id;
+ image->type = formats[i].type;
+ image->byte_order = formats[i].byte_order;
+ memcpy(image->guid, formats[i].guid, 16);
+ image->bits_per_pixel = formats[i].bpp;
+ image->format = formats[i].format;
+ image->num_planes = formats[i].num_planes;
+ image->depth = formats[i].depth;
+ image->red_mask = formats[i].red_mask;
+ image->green_mask = formats[i].green_mask;
+ image->blue_mask = formats[i].blue_mask;
+ image->y_sample_bits = formats[i].y_sample_bits;
+ image->u_sample_bits = formats[i].u_sample_bits;
+ image->v_sample_bits = formats[i].v_sample_bits;
+ image->horz_y_period = formats[i].vhorz_y_period;
+ image->horz_u_period = formats[i].vhorz_u_period;
+ image->horz_v_period = formats[i].vhorz_v_period;
+ image->vert_y_period = formats[i].vvert_y_period;
+ image->vert_u_period = formats[i].vvert_u_period;
+ image->vert_v_period = formats[i].vvert_v_period;
+ memcpy(image->component_order, formats[i].vcomp_order, 32);
+ image->scanline_order = formats[i].vscanline_order;
+ }
+
+ free(reply);
+ return TRUE;
+}
+
+static Bool
ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this)
{
xcb_connection_t *conn = hostx_get_xcbconn();
xcb_screen_t *xscreen = xcb_aux_get_screen(conn, hostx_get_screen());
- EphyrHostImageFormat *image_formats = NULL;
- int base_port_id = 0,
- num_formats = 0, i = 0, port_priv_offset = 0;
+ int base_port_id = 0, i = 0, port_priv_offset = 0;
Bool is_ok = FALSE;
xcb_generic_error_t *e = NULL;
xcb_xv_adaptor_info_iterator_t it;
@@ -535,14 +587,11 @@ ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this)
}
}
- if (!ephyrHostXVQueryImageFormats(base_port_id,
- &image_formats, &num_formats)) {
+ if (!translate_xv_image_formats(&a_this->adaptors[i], cur_host_adaptor)) {
EPHYR_LOG_ERROR("failed to get image formats "
"for adaptor %d\n", i);
continue;
}
- a_this->adaptors[i].pImages = (KdImagePtr) image_formats;
- a_this->adaptors[i].nImages = num_formats;
xcb_xv_adaptor_info_next(&it);
}
--
1.8.4.rc3
More information about the xorg-devel
mailing list