diff options
author | Dodji Seketeli <dodji@openedhand.com> | 2007-10-03 13:03:34 +0200 |
---|---|---|
committer | Dodji Seketeli <dodji@openedhand.com> | 2007-10-03 13:03:34 +0200 |
commit | 4ba76a7e2b62d26f43c0e670de571afb75ec92f4 (patch) | |
tree | 2904cc659051577831e33fab78e92b6a2dc23e03 | |
parent | dcb4db1bf5b6fcfaed4e7162eb6c7a3a509e14bd (diff) |
Xephyr: port XV/GL stuff of the new multiscreen architecture
We can now launch GL or XV apps in any of the
Xephyr screens we want.
* hw/kdrive/ephyr/hostx.c,h:
(hostx_get_window):
(hostx_create_window): make these functions be screen
number aware.
* hw/kdrive/ephyr/XF86dri.c : fix some compiler warnings.
* hw/kdrive/ephyr/ephyrdri.c:
(ephyrDRIQueryDirectRenderingCapable),
(ephyrDRIOpenConnection),
(ephyrDRIAuthConnection),
(ephyrDRICloseConnection),
(ephyrDRIGetClientDriverName),
(ephyrDRICreateContext),
(ephyrDRIDestroyContext),
(ephyrDRICreateDrawable),
(ephyrDRIGetDrawableInfo),
(ephyrDRIGetDeviceInfo): in all those functions, don't forward
the screen number we receive - from the client - to the host X.
We (Xephyr) are always targetting the same X display screen, which is
the one Xephyr got launched against. So we enforce that in the code.
* hw/kdrive/ephyr/ephyrdriext.c:
(EphyrMirrorHostVisuals): make this duplicate the visuals of the host X
default screen into a given Xephyr screen. This way we have a chance
to update the visuals of all Xephyr screen to make them mirror those
of the host X.
(many other places): specify screen number where required by the api
change in hostx.h.
* hw/kdrive/ephyr/ephyrglxext.c: specify screen number where required
by the api change in hostx.h
* hw/kdrive/ephyr/ephyrhostglx.c: don't forward the screen number we
receive - from the client - to the host X.
We (Xephyr) are always targetting the same
X display screen, which is
the one Xephyr got launched against. So we enforce that in the code.
* hw/kdrive/ephyr/ephyrhostvideo.c,h: take in account the screen number received
from the client app. This is useful to know on which Xephyr screen we
need to display video stuff.
* hw/kdrive/ephyr/ephyrvideo.c: update this to reflect the API change
in hw/kdrive/ephyr/ephyrhostvideo.h.
(ephyrSetPortAttribute): when parameters are not valid
- they exceed their validity range - send them to the host anyway
and do not return an error to clients.
Some host expose buggy validity range, so rejecting client for that
is too harsh.
-rw-r--r-- | hw/kdrive/ephyr/XF86dri.c | 2 | ||||
-rw-r--r-- | hw/kdrive/ephyr/ephyrdri.c | 24 | ||||
-rw-r--r-- | hw/kdrive/ephyr/ephyrdriext.c | 13 | ||||
-rw-r--r-- | hw/kdrive/ephyr/ephyrglxext.c | 17 | ||||
-rw-r--r-- | hw/kdrive/ephyr/ephyrhostglx.c | 10 | ||||
-rw-r--r-- | hw/kdrive/ephyr/ephyrhostvideo.c | 36 | ||||
-rw-r--r-- | hw/kdrive/ephyr/ephyrhostvideo.h | 17 | ||||
-rw-r--r-- | hw/kdrive/ephyr/ephyrvideo.c | 42 | ||||
-rw-r--r-- | hw/kdrive/ephyr/hostx.c | 13 | ||||
-rw-r--r-- | hw/kdrive/ephyr/hostx.h | 12 |
10 files changed, 123 insertions, 63 deletions
diff --git a/hw/kdrive/ephyr/XF86dri.c b/hw/kdrive/ephyr/XF86dri.c index f3f317907..ae2ec890f 100644 --- a/hw/kdrive/ephyr/XF86dri.c +++ b/hw/kdrive/ephyr/XF86dri.c @@ -107,6 +107,8 @@ static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xf86dri_info) #define TRACE(msg) #endif +Bool XF86DRIOpenFullScreen(Display *dpy, int screen, Drawable drawable); +Bool XF86DRICloseFullScreen(Display *dpy, int screen, Drawable drawable); Bool XF86DRIQueryExtension (Display *dpy, int *event_basep, int *error_basep) { diff --git a/hw/kdrive/ephyr/ephyrdri.c b/hw/kdrive/ephyr/ephyrdri.c index e7d412881..53a96ba11 100644 --- a/hw/kdrive/ephyr/ephyrdri.c +++ b/hw/kdrive/ephyr/ephyrdri.c @@ -59,7 +59,8 @@ ephyrDRIQueryDirectRenderingCapable (int a_screen, Bool *a_is_capable) EPHYR_RETURN_VAL_IF_FAIL (a_is_capable, FALSE) ; EPHYR_LOG ("enter\n") ; - is_ok = XF86DRIQueryDirectRenderingCapable (dpy, a_screen, a_is_capable) ; + is_ok = XF86DRIQueryDirectRenderingCapable (dpy, DefaultScreen (dpy), + a_is_capable) ; EPHYR_LOG ("leave. is_capable:%d, is_ok=%d\n", *a_is_capable, is_ok) ; return is_ok ; @@ -75,7 +76,9 @@ ephyrDRIOpenConnection (int a_screen, EPHYR_RETURN_VAL_IF_FAIL (a_bus_id_string, FALSE) ; EPHYR_LOG ("enter. screen:%d\n", a_screen) ; - is_ok = XF86DRIOpenConnection (dpy, a_screen, a_sarea, a_bus_id_string) ; + is_ok = XF86DRIOpenConnection (dpy, DefaultScreen (dpy), + a_sarea, + a_bus_id_string) ; if (*a_bus_id_string) { EPHYR_LOG ("leave. bus_id_string:%s, is_ok:%d\n", *a_bus_id_string, is_ok) ; @@ -93,7 +96,7 @@ ephyrDRIAuthConnection (int a_screen, drm_magic_t a_magic) Bool is_ok=FALSE ; EPHYR_LOG ("enter\n") ; - is_ok = XF86DRIAuthConnection (dpy, a_screen, a_magic) ; + is_ok = XF86DRIAuthConnection (dpy, DefaultScreen (dpy), a_magic) ; EPHYR_LOG ("leave. is_ok:%d\n", is_ok) ; return is_ok ; } @@ -105,7 +108,7 @@ ephyrDRICloseConnection (int a_screen) Bool is_ok=FALSE ; EPHYR_LOG ("enter\n") ; - is_ok = XF86DRICloseConnection (dpy, a_screen) ; + is_ok = XF86DRICloseConnection (dpy, DefaultScreen (dpy)) ; EPHYR_LOG ("leave\n") ; return is_ok ; } @@ -126,7 +129,7 @@ ephyrDRIGetClientDriverName (int a_screen, && a_client_driver_name, FALSE); EPHYR_LOG ("enter\n") ; - is_ok = XF86DRIGetClientDriverName (dpy, a_screen, + is_ok = XF86DRIGetClientDriverName (dpy, DefaultScreen (dpy), a_ddx_driver_major_version, a_ddx_driver_minor_version, a_ddx_driver_patch_version, @@ -154,7 +157,7 @@ ephyrDRICreateContext (int a_screen, memset (&v, 0, sizeof (v)) ; v.visualid = a_visual_id ; is_ok = XF86DRICreateContext (dpy, - a_screen, + DefaultScreen (dpy), &v, a_returned_ctxt_id, a_hw_ctxt) ; @@ -170,7 +173,7 @@ ephyrDRIDestroyContext (int a_screen, Bool is_ok=FALSE ; EPHYR_LOG ("enter\n") ; - is_ok = XF86DRIDestroyContext (dpy, a_screen, a_context_id) ; + is_ok = XF86DRIDestroyContext (dpy, DefaultScreen (dpy), a_context_id) ; EPHYR_LOG ("leave:%d\n", is_ok) ; return is_ok ; } @@ -184,7 +187,8 @@ ephyrDRICreateDrawable (int a_screen, Display *dpy=hostx_get_display () ; EPHYR_LOG ("enter\n") ; - is_ok = XF86DRICreateDrawable (dpy, a_screen, a_drawable, a_hw_drawable) ; + is_ok = XF86DRICreateDrawable (dpy, DefaultScreen (dpy), + a_drawable, a_hw_drawable) ; EPHYR_LOG ("leave. is_ok:%d\n", is_ok) ; return is_ok ; } @@ -228,7 +232,7 @@ ephyrDRIGetDrawableInfo (int a_screen, EPHYR_LOG_ERROR ("failed to query host window attributes\n") ; goto out; } - if (!XF86DRIGetDrawableInfo (dpy, a_screen, a_drawable, + if (!XF86DRIGetDrawableInfo (dpy, DefaultScreen (dpy), a_drawable, a_index, a_stamp, a_x, a_y, a_w, a_h, @@ -277,7 +281,7 @@ ephyrDRIGetDeviceInfo (int a_screen, EPHYR_RETURN_VAL_IF_FAIL (dpy, FALSE) ; EPHYR_LOG ("enter\n") ; - is_ok = XF86DRIGetDeviceInfo (dpy, a_screen, a_frame_buffer, + is_ok = XF86DRIGetDeviceInfo (dpy, DefaultScreen (dpy), a_frame_buffer, a_fb_origin, a_fb_size, a_fb_stride, a_dev_private_size, a_dev_private) ; EPHYR_LOG ("leave:%d\n", is_ok) ; diff --git a/hw/kdrive/ephyr/ephyrdriext.c b/hw/kdrive/ephyr/ephyrdriext.c index 26c792d52..e3d0cfbb4 100644 --- a/hw/kdrive/ephyr/ephyrdriext.c +++ b/hw/kdrive/ephyr/ephyrdriext.c @@ -111,7 +111,7 @@ static Bool ephyrDRIPositionWindow (WindowPtr a_win, static void ephyrDRIClipNotify (WindowPtr a_win, int a_x, int a_y) ; -static Bool EphyrMirrorHostVisuals (void) ; +static Bool EphyrMirrorHostVisuals (ScreenPtr a_screen) ; static Bool destroyHostPeerWindow (const WindowPtr a_win) ; static Bool findWindowPairFromLocal (WindowPtr a_local, EphyrWindowPair **a_pair); @@ -182,7 +182,7 @@ ephyrDRIExtensionInit (ScreenPtr a_screen) EPHYR_LOG_ERROR ("ephyrDRIScreenInit() failed\n") ; goto out ; } - EphyrMirrorHostVisuals () ; + EphyrMirrorHostVisuals (a_screen) ; if (ephyrDRIGeneration != serverGeneration) { ephyrDRIGeneration = serverGeneration ; } @@ -607,7 +607,7 @@ out: * GLX. */ static Bool -EphyrMirrorHostVisuals (void) +EphyrMirrorHostVisuals (ScreenPtr a_screen) { Bool is_ok=FALSE; EphyrHostVisualInfo *visuals=NULL; @@ -619,7 +619,7 @@ EphyrMirrorHostVisuals (void) goto out ; } for (i=0; i<nb_visuals; i++) { - if (!EphyrDuplicateVisual (visuals[i].screen, + if (!EphyrDuplicateVisual (a_screen->myNum, visuals[i].depth, visuals[i].class, visuals[i].bits_per_rgb, @@ -980,6 +980,8 @@ createHostPeerWindow (const WindowPtr a_win, EphyrBox geo ; EPHYR_RETURN_VAL_IF_FAIL (a_win && a_peer_win, FALSE) ; + EPHYR_RETURN_VAL_IF_FAIL (a_win->drawable.pScreen, + FALSE) ; EPHYR_LOG ("enter. a_win '%#x'\n", (unsigned int)a_win) ; if (!getWindowVisual (a_win, &visual)) { @@ -995,7 +997,8 @@ createHostPeerWindow (const WindowPtr a_win, geo.y = a_win->drawable.y ; geo.width = a_win->drawable.width ; geo.height = a_win->drawable.height ; - if (!hostx_create_window (&geo, visual->vid, a_peer_win)) { + if (!hostx_create_window (a_win->drawable.pScreen->myNum, + &geo, visual->vid, a_peer_win)) { EPHYR_LOG_ERROR ("failed to create host peer window\n") ; goto out ; } diff --git a/hw/kdrive/ephyr/ephyrglxext.c b/hw/kdrive/ephyr/ephyrglxext.c index 47c4fb1c8..381c9d7ed 100644 --- a/hw/kdrive/ephyr/ephyrglxext.c +++ b/hw/kdrive/ephyr/ephyrglxext.c @@ -438,7 +438,8 @@ ephyrGLXCreateContextReal (xGLXCreateContextReq *a_req, Bool a_do_swap) (int)a_req->visual, (int)a_req->isDirect) ; memset (&host_w_attrs, 0, sizeof (host_w_attrs)) ; - if (!hostx_get_window_attributes (hostx_get_window (), &host_w_attrs)) { + if (!hostx_get_window_attributes (hostx_get_window (a_req->screen), + &host_w_attrs)) { EPHYR_LOG_ERROR ("failed to get host window attrs\n") ; goto out ; } @@ -513,10 +514,22 @@ ephyrGLXMakeCurrentReal (__GLXclientState *a_cl, GLbyte *a_pc, Bool a_do_swap) int res=BadImplementation; xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) a_pc; xGLXMakeCurrentReply reply ; + DrawablePtr drawable=NULL; + int rc=0; EPHYR_LOG ("enter\n") ; + rc = dixLookupDrawable (&drawable, + req->drawable, + a_cl->client, + 0, + DixReadAccess); + EPHYR_RETURN_VAL_IF_FAIL (drawable, BadValue) ; + EPHYR_RETURN_VAL_IF_FAIL (drawable->pScreen, BadValue) ; + EPHYR_LOG ("screen nummber requested:%d\n", + drawable->pScreen->myNum) ; + memset (&reply, 0, sizeof (reply)) ; - if (!ephyrHostGLXMakeCurrent (hostx_get_window (), + if (!ephyrHostGLXMakeCurrent (hostx_get_window (drawable->pScreen->myNum), req->context, req->oldContextTag, (int*)&reply.contextTag)) { diff --git a/hw/kdrive/ephyr/ephyrhostglx.c b/hw/kdrive/ephyr/ephyrhostglx.c index ad86d3009..5d9a482e8 100644 --- a/hw/kdrive/ephyr/ephyrhostglx.c +++ b/hw/kdrive/ephyr/ephyrhostglx.c @@ -188,7 +188,7 @@ ephyrHostGLXGetStringFromServer (int a_screen_number, GetReq (GLXGenericGetString, req); req->reqType = major_opcode; req->glxCode = get_string_op; - req->for_whom = a_screen_number; + req->for_whom = DefaultScreen (dpy); req->name = a_string_name; _XReply (dpy, (xReply *)&reply, 0, False); @@ -263,7 +263,7 @@ ephyrHostGLXGetVisualConfigsInternal (enum VisualConfRequestType a_type, GetReq(GLXGetFBConfigs,fb_req); fb_req->reqType = major_opcode; fb_req->glxCode = X_GLXGetFBConfigs; - fb_req->screen = a_screen; + fb_req->screen = DefaultScreen (dpy); break; case EPHYR_VENDOR_PRIV_GET_FB_CONFIG_SGIX: @@ -276,14 +276,14 @@ ephyrHostGLXGetVisualConfigsInternal (enum VisualConfRequestType a_type, sgi_req->reqType = major_opcode; sgi_req->glxCode = X_GLXVendorPrivateWithReply; sgi_req->vendorCode = X_GLXvop_GetFBConfigsSGIX; - sgi_req->screen = a_screen; + sgi_req->screen = DefaultScreen (dpy); break; case EPHYR_GET_VISUAL_CONFIGS: GetReq(GLXGetVisualConfigs,req); req->reqType = major_opcode; req->glxCode = X_GLXGetVisualConfigs; - req->screen = a_screen; + req->screen = DefaultScreen (dpy); break; } @@ -460,7 +460,7 @@ ephyrHostGLXCreateContext (int a_screen, req->glxCode = X_GLXCreateContext; req->context = remote_context_id; req->visual = a_visual_id; - req->screen = a_screen; + req->screen = DefaultScreen (dpy); req->shareList = a_share_list_ctxt_id; req->isDirect = a_direct; diff --git a/hw/kdrive/ephyr/ephyrhostvideo.c b/hw/kdrive/ephyr/ephyrhostvideo.c index a0ca76bb4..562c2a4e8 100644 --- a/hw/kdrive/ephyr/ephyrhostvideo.c +++ b/hw/kdrive/ephyr/ephyrhostvideo.c @@ -745,7 +745,8 @@ ephyrHostFree (void *a_pointer) } Bool -ephyrHostXVPutImage (int a_port_id, +ephyrHostXVPutImage (int a_screen_num, + int a_port_id, int a_image_id, int a_drw_x, int a_drw_y, @@ -774,7 +775,7 @@ ephyrHostXVPutImage (int a_port_id, EPHYR_LOG ("enter, num_clip_rects: %d\n", a_clip_rect_nums) ; memset (&gc_values, 0, sizeof (gc_values)) ; - gc = XCreateGC (dpy, hostx_get_window (), 0L, &gc_values); + gc = XCreateGC (dpy, hostx_get_window (a_screen_num), 0L, &gc_values); if (!gc) { EPHYR_LOG_ERROR ("failed to create gc \n") ; goto out ; @@ -802,7 +803,8 @@ ephyrHostXVPutImage (int a_port_id, XSetClipRectangles (dpy, gc, 0, 0, rects, a_clip_rect_nums, YXBanded) ; /*this always returns 1*/ } - res = XvPutImage (dpy, a_port_id, hostx_get_window (), + res = XvPutImage (dpy, a_port_id, + hostx_get_window (a_screen_num), gc, xv_image, a_src_x, a_src_y, a_src_w, a_src_h, a_drw_x, a_drw_y, a_drw_w, a_drw_h) ; @@ -830,7 +832,7 @@ out: } Bool -ephyrHostXVPutVideo (int a_port_id, +ephyrHostXVPutVideo (int a_screen_num, int a_port_id, int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h, int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h) { @@ -842,12 +844,12 @@ ephyrHostXVPutVideo (int a_port_id, EPHYR_RETURN_VAL_IF_FAIL (dpy, FALSE) ; - gc = XCreateGC (dpy, hostx_get_window (), 0L, &gc_values); + gc = XCreateGC (dpy, hostx_get_window (a_screen_num), 0L, &gc_values); if (!gc) { EPHYR_LOG_ERROR ("failed to create gc \n") ; goto out ; } - res = XvPutVideo (dpy, a_port_id, hostx_get_window (), gc, + res = XvPutVideo (dpy, a_port_id, hostx_get_window (a_screen_num), gc, a_vid_x, a_vid_y, a_vid_w, a_vid_h, a_drw_x, a_drw_y, a_drw_w, a_drw_h) ; @@ -867,7 +869,7 @@ out: } Bool -ephyrHostXVGetVideo (int a_port_id, +ephyrHostXVGetVideo (int a_screen_num, int a_port_id, int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h, int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h) { @@ -879,12 +881,12 @@ ephyrHostXVGetVideo (int a_port_id, EPHYR_RETURN_VAL_IF_FAIL (dpy, FALSE) ; - gc = XCreateGC (dpy, hostx_get_window (), 0L, &gc_values); + gc = XCreateGC (dpy, hostx_get_window (a_screen_num), 0L, &gc_values); if (!gc) { EPHYR_LOG_ERROR ("failed to create gc \n") ; goto out ; } - res = XvGetVideo (dpy, a_port_id, hostx_get_window (), gc, + res = XvGetVideo (dpy, a_port_id, hostx_get_window (a_screen_num), gc, a_vid_x, a_vid_y, a_vid_w, a_vid_h, a_drw_x, a_drw_y, a_drw_w, a_drw_h) ; @@ -904,7 +906,7 @@ out: } Bool -ephyrHostXVPutStill (int a_port_id, +ephyrHostXVPutStill (int a_screen_num, int a_port_id, int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h, int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h) { @@ -916,12 +918,12 @@ ephyrHostXVPutStill (int a_port_id, EPHYR_RETURN_VAL_IF_FAIL (dpy, FALSE) ; - gc = XCreateGC (dpy, hostx_get_window (), 0L, &gc_values); + gc = XCreateGC (dpy, hostx_get_window (a_screen_num), 0L, &gc_values); if (!gc) { EPHYR_LOG_ERROR ("failed to create gc \n") ; goto out ; } - res = XvPutStill (dpy, a_port_id, hostx_get_window (), gc, + res = XvPutStill (dpy, a_port_id, hostx_get_window (a_screen_num), gc, a_vid_x, a_vid_y, a_vid_w, a_vid_h, a_drw_x, a_drw_y, a_drw_w, a_drw_h) ; @@ -941,7 +943,7 @@ out: } Bool -ephyrHostXVGetStill (int a_port_id, +ephyrHostXVGetStill (int a_screen_num, int a_port_id, int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h, int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h) { @@ -953,12 +955,12 @@ ephyrHostXVGetStill (int a_port_id, EPHYR_RETURN_VAL_IF_FAIL (dpy, FALSE) ; - gc = XCreateGC (dpy, hostx_get_window (), 0L, &gc_values); + gc = XCreateGC (dpy, hostx_get_window (a_screen_num), 0L, &gc_values); if (!gc) { EPHYR_LOG_ERROR ("failed to create gc \n") ; goto out ; } - res = XvGetStill (dpy, a_port_id, hostx_get_window (), gc, + res = XvGetStill (dpy, a_port_id, hostx_get_window (a_screen_num), gc, a_vid_x, a_vid_y, a_vid_w, a_vid_h, a_drw_x, a_drw_y, a_drw_w, a_drw_h) ; @@ -978,7 +980,7 @@ out: } Bool -ephyrHostXVStopVideo (int a_port_id) +ephyrHostXVStopVideo (int a_screen_num, int a_port_id) { int ret=0 ; Bool is_ok=FALSE ; @@ -988,7 +990,7 @@ ephyrHostXVStopVideo (int a_port_id) EPHYR_LOG ("enter\n") ; - ret = XvStopVideo (dpy, a_port_id, hostx_get_window ()) ; + ret = XvStopVideo (dpy, a_port_id, hostx_get_window (a_screen_num)) ; if (ret != Success) { EPHYR_LOG_ERROR ("XvStopVideo() failed: %d \n", ret) ; goto out ; diff --git a/hw/kdrive/ephyr/ephyrhostvideo.h b/hw/kdrive/ephyr/ephyrhostvideo.h index 64b224f1c..05ee38a03 100644 --- a/hw/kdrive/ephyr/ephyrhostvideo.h +++ b/hw/kdrive/ephyr/ephyrhostvideo.h @@ -189,7 +189,8 @@ char* ephyrHostGetAtomName (int a_atom) ; *PutImage * (ignore clipping for now) */ -Bool ephyrHostXVPutImage (int a_port_id, +Bool ephyrHostXVPutImage (int a_screen_num, + int a_port_id, int a_image_id, int a_drw_x, int a_drw_y, @@ -208,26 +209,30 @@ Bool ephyrHostXVPutImage (int a_port_id, /* * Putvideo/PutStill/GetVideo */ -Bool ephyrHostXVPutVideo (int a_port_id, +Bool ephyrHostXVPutVideo (int a_screen_num, + int a_port_id, int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h, int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h) ; -Bool ephyrHostXVGetVideo (int a_port_id, +Bool ephyrHostXVGetVideo (int a_screen_num, + int a_port_id, int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h, int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h) ; -Bool ephyrHostXVPutStill (int a_port_id, +Bool ephyrHostXVPutStill (int a_screen_num, + int a_port_id, int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h, int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h) ; -Bool ephyrHostXVGetStill (int a_port_id, +Bool ephyrHostXVGetStill (int a_screen_num, + int a_port_id, int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h, int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h) ; /* * StopVideo */ -Bool ephyrHostXVStopVideo (int a_port_id) ; +Bool ephyrHostXVStopVideo (int a_screen_num, int a_port_id) ; #endif /*__EPHYRHOSTVIDEO_H__*/ diff --git a/hw/kdrive/ephyr/ephyrvideo.c b/hw/kdrive/ephyr/ephyrvideo.c index 521f3a6b5..bfe4d7223 100644 --- a/hw/kdrive/ephyr/ephyrvideo.c +++ b/hw/kdrive/ephyr/ephyrvideo.c @@ -705,6 +705,11 @@ ephyrXVPrivIsAttrValueValid (KdAttributePtr a_attrs, if (a_attrs[i].min_value > a_attr_value || a_attrs[i].max_value < a_attr_value) { *a_is_valid = FALSE ; + EPHYR_LOG_ERROR ("attribute was not valid\n" + "value:%d. min:%d. max:%d\n", + a_attr_value, + a_attrs[i].min_value, + a_attrs[i].max_value) ; } else { *a_is_valid = TRUE ; } @@ -771,10 +776,12 @@ ephyrStopVideo (KdScreenInfo *a_info, pointer a_port_priv, Bool a_exit) { EphyrPortPriv *port_priv = a_port_priv ; + EPHYR_RETURN_IF_FAIL (a_info && a_info->pScreen) ; EPHYR_RETURN_IF_FAIL (port_priv) ; EPHYR_LOG ("enter\n") ; - if (!ephyrHostXVStopVideo (port_priv->port_number)) { + if (!ephyrHostXVStopVideo (a_info->pScreen->myNum, + port_priv->port_number)) { EPHYR_LOG_ERROR ("XvStopVideo() failed\n") ; } EPHYR_LOG ("leave\n") ; @@ -817,14 +824,18 @@ ephyrSetPortAttribute (KdScreenInfo *a_info, &is_attr_valid)) { EPHYR_LOG_ERROR ("failed to validate attribute %s\n", NameForAtom (a_attr_name)) ; - res = BadMatch ; - goto out ; + /* + res = BadMatch ; + goto out ; + */ } if (!is_attr_valid) { EPHYR_LOG_ERROR ("attribute %s is not valid\n", NameForAtom (a_attr_name)) ; + /* res = BadMatch ; goto out ; + */ } if (!ephyrHostXVSetPortAttribute (port_priv->port_number, @@ -929,11 +940,13 @@ ephyrPutImage (KdScreenInfo *a_info, Bool is_ok=FALSE ; int result=BadImplementation, image_size=0 ; + EPHYR_RETURN_VAL_IF_FAIL (a_info && a_info->pScreen, BadValue) ; EPHYR_RETURN_VAL_IF_FAIL (a_drawable, BadValue) ; EPHYR_LOG ("enter\n") ; - if (!ephyrHostXVPutImage (port_priv->port_number, + if (!ephyrHostXVPutImage (a_info->pScreen->myNum, + port_priv->port_number, a_id, a_drw_x, a_drw_y, a_drw_w, a_drw_h, a_src_x, a_src_y, a_src_w, a_src_h, @@ -999,6 +1012,7 @@ ephyrReputImage (KdScreenInfo *a_info, EphyrPortPriv *port_priv = a_port_priv ; int result=BadImplementation ; + EPHYR_RETURN_VAL_IF_FAIL (a_info->pScreen, FALSE) ; EPHYR_RETURN_VAL_IF_FAIL (a_drawable && port_priv, BadValue) ; EPHYR_LOG ("enter\n") ; @@ -1007,7 +1021,9 @@ ephyrReputImage (KdScreenInfo *a_info, EPHYR_LOG_ERROR ("has null image buf in cache\n") ; goto out ; } - if (!ephyrHostXVPutImage (port_priv->port_number, port_priv->image_id, + if (!ephyrHostXVPutImage (a_info->pScreen->myNum, + port_priv->port_number, + port_priv->image_id, a_drw_x, a_drw_y, port_priv->drw_w, port_priv->drw_h, port_priv->src_x, port_priv->src_y, @@ -1042,6 +1058,7 @@ ephyrPutVideo (KdScreenInfo *a_info, int result=BadImplementation ; int drw_x=0, drw_y=0, drw_w=0, drw_h=0 ; + EPHYR_RETURN_VAL_IF_FAIL (a_info->pScreen, BadValue) ; EPHYR_RETURN_VAL_IF_FAIL (a_drawable && port_priv, BadValue) ; EPHYR_LOG ("enter\n") ; @@ -1063,7 +1080,8 @@ ephyrPutVideo (KdScreenInfo *a_info, drw_w = clipped_area.x2 - clipped_area.x1 ; drw_h = clipped_area.y2 - clipped_area.y1 ; - if (!ephyrHostXVPutVideo (port_priv->port_number, + if (!ephyrHostXVPutVideo (a_info->pScreen->myNum, + port_priv->port_number, a_vid_x, a_vid_y, a_vid_w, a_vid_h, a_drw_x, a_drw_y, a_drw_w, a_drw_h)) { EPHYR_LOG_ERROR ("ephyrHostXVPutVideo() failed\n") ; @@ -1091,6 +1109,7 @@ ephyrGetVideo (KdScreenInfo *a_info, int result=BadImplementation ; int drw_x=0, drw_y=0, drw_w=0, drw_h=0 ; + EPHYR_RETURN_VAL_IF_FAIL (a_info && a_info->pScreen, BadValue) ; EPHYR_RETURN_VAL_IF_FAIL (a_drawable && port_priv, BadValue) ; EPHYR_LOG ("enter\n") ; @@ -1112,7 +1131,8 @@ ephyrGetVideo (KdScreenInfo *a_info, drw_w = clipped_area.x2 - clipped_area.x1 ; drw_h = clipped_area.y2 - clipped_area.y1 ; - if (!ephyrHostXVGetVideo (port_priv->port_number, + if (!ephyrHostXVGetVideo (a_info->pScreen->myNum, + port_priv->port_number, a_vid_x, a_vid_y, a_vid_w, a_vid_h, a_drw_x, a_drw_y, a_drw_w, a_drw_h)) { EPHYR_LOG_ERROR ("ephyrHostXVGetVideo() failed\n") ; @@ -1140,6 +1160,7 @@ ephyrPutStill (KdScreenInfo *a_info, int result=BadImplementation ; int drw_x=0, drw_y=0, drw_w=0, drw_h=0 ; + EPHYR_RETURN_VAL_IF_FAIL (a_info && a_info->pScreen, BadValue) ; EPHYR_RETURN_VAL_IF_FAIL (a_drawable && port_priv, BadValue) ; EPHYR_LOG ("enter\n") ; @@ -1161,7 +1182,8 @@ ephyrPutStill (KdScreenInfo *a_info, drw_w = clipped_area.x2 - clipped_area.x1 ; drw_h = clipped_area.y2 - clipped_area.y1 ; - if (!ephyrHostXVPutStill (port_priv->port_number, + if (!ephyrHostXVPutStill (a_info->pScreen->myNum, + port_priv->port_number, a_vid_x, a_vid_y, a_vid_w, a_vid_h, a_drw_x, a_drw_y, a_drw_w, a_drw_h)) { EPHYR_LOG_ERROR ("ephyrHostXVPutStill() failed\n") ; @@ -1189,6 +1211,7 @@ ephyrGetStill (KdScreenInfo *a_info, int result=BadImplementation ; int drw_x=0, drw_y=0, drw_w=0, drw_h=0 ; + EPHYR_RETURN_VAL_IF_FAIL (a_info && a_info->pScreen, BadValue) ; EPHYR_RETURN_VAL_IF_FAIL (a_drawable && port_priv, BadValue) ; EPHYR_LOG ("enter\n") ; @@ -1210,7 +1233,8 @@ ephyrGetStill (KdScreenInfo *a_info, drw_w = clipped_area.x2 - clipped_area.x1 ; drw_h = clipped_area.y2 - clipped_area.y1 ; - if (!ephyrHostXVGetStill (port_priv->port_number, + if (!ephyrHostXVGetStill (a_info->pScreen->myNum, + port_priv->port_number, a_vid_x, a_vid_y, a_vid_w, a_vid_h, a_drw_x, a_drw_y, a_drw_w, a_drw_h)) { EPHYR_LOG_ERROR ("ephyrHostXVGetStill() failed\n") ; diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c index 0ef1a6283..181edd226 100644 --- a/hw/kdrive/ephyr/hostx.c +++ b/hw/kdrive/ephyr/hostx.c @@ -978,9 +978,13 @@ hostx_get_display(void) } int -hostx_get_window(void) +hostx_get_window (int a_screen_number) { - return HostX.win ; + if (a_screen_number < 0 || a_screen_number >= HostX.n_screens) { + EPHYR_LOG_ERROR ("bad screen number:%d\n", a_screen_number) ; + return 0; + } + return HostX.screens[a_screen_number].win ; } int @@ -1085,7 +1089,8 @@ static ResourcePair resource_peers[RESOURCE_PEERS_SIZE] ; int -hostx_create_window (EphyrBox *a_geometry, +hostx_create_window (int a_screen_number, + EphyrBox *a_geometry, int a_visual_id, int *a_host_peer /*out parameter*/) { @@ -1120,7 +1125,7 @@ hostx_create_window (EphyrBox *a_geometry, AllocNone) ; winmask = CWColormap; - win = XCreateWindow (dpy, hostx_get_window (), + win = XCreateWindow (dpy, hostx_get_window (a_screen_number), a_geometry->x, a_geometry->y, a_geometry->width, a_geometry->height, 0, visual_info->depth, InputOutput, diff --git a/hw/kdrive/ephyr/hostx.h b/hw/kdrive/ephyr/hostx.h index 941eeceb5..3caa466a7 100644 --- a/hw/kdrive/ephyr/hostx.h +++ b/hw/kdrive/ephyr/hostx.h @@ -193,16 +193,16 @@ hostx_paint_rect(EphyrScreenInfo screen, void -hostx_load_keymap(void); +hostx_load_keymap (void); int -hostx_get_event(EphyrHostXEvent *ev); +hostx_get_event (EphyrHostXEvent *ev); void* -hostx_get_display(void) ; +hostx_get_display (void) ; int -hostx_get_window(void) ; +hostx_get_window (int a_screen_number) ; int hostx_get_window_attributes (int a_window, EphyrHostWindowAttributes *a_attr) ; @@ -216,7 +216,8 @@ int hostx_get_visuals_info (EphyrHostVisualInfo **a_visuals, int *a_num_entries) ; -int hostx_create_window (EphyrBox *a_geometry, +int hostx_create_window (int a_screen_number, + EphyrBox *a_geometry, int a_visual_id, int *a_host_win /*out parameter*/) ; @@ -228,6 +229,7 @@ int hostx_set_window_geometry (int a_win, EphyrBox *a_geo) ; int hostx_set_window_bounding_rectangles (int a_window, EphyrRect *a_rects, int a_num_rects) ; + int hostx_set_window_clipping_rectangles (int a_window, EphyrRect *a_rects, int a_num_rects) ; |