diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2011-10-26 15:08:18 +0200 |
---|---|---|
committer | Thomas Hellstrom <thellstrom@vmware.com> | 2011-10-31 15:20:53 +0100 |
commit | 55113dae7cbe99bfb69869831536ff34ed445c73 (patch) | |
tree | d86bcb65c7f0b88d6739e8c4288f695b25f0dfa9 | |
parent | c73a7f3d991dd95d332829f2ca8a88aabfea5a46 (diff) |
vmwgfx: Hook up vmwarectrl to the gui layout ioctl
Requires drm 2.3.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
-rw-r--r-- | vmwgfx/vmwgfx_ctrl.c | 26 | ||||
-rw-r--r-- | vmwgfx/vmwgfx_driver.c | 2 | ||||
-rw-r--r-- | vmwgfx/vmwgfx_drm.h | 70 | ||||
-rw-r--r-- | vmwgfx/vmwgfx_drmi.c | 16 | ||||
-rw-r--r-- | vmwgfx/vmwgfx_drmi.h | 4 |
5 files changed, 102 insertions, 16 deletions
diff --git a/vmwgfx/vmwgfx_ctrl.c b/vmwgfx/vmwgfx_ctrl.c index 5157f86..3185879 100644 --- a/vmwgfx/vmwgfx_ctrl.c +++ b/vmwgfx/vmwgfx_ctrl.c @@ -39,9 +39,8 @@ #include <X11/extensions/panoramiXproto.h> #include "vmwarectrlproto.h" -#include "xf86drm.h" #include "vmwgfx_driver.h" - +#include "vmwgfx_drmi.h" /* *---------------------------------------------------------------------------- @@ -110,17 +109,17 @@ VMwareCtrlDoSetRes(ScrnInfoPtr pScrn, CARD32 x, CARD32 y) { -#if 0 - struct vmw_rect rect; + modesettingPtr ms = modesettingPTR(pScrn); + struct drm_vmw_rect rect; + int ret; + rect.x = 0; rect.y = 0; rect.w = x; rect.h = y; - vmw_ioctl_update_layout(vmw, 1, &rect); -#endif - - return TRUE; + ret = vmwgfx_update_gui_layout(ms->fd, 1, &rect); + return (ret == 0); } @@ -208,10 +207,10 @@ VMwareCtrlDoSetTopology(ScrnInfoPtr pScrn, xXineramaScreenInfo *extents, unsigned long number) { -#if 0 - struct vmw_rect *rects; - struct vmw_customizer *vmw = vmw_customizer(xorg_customizer(pScrn)); + modesettingPtr ms = modesettingPTR(pScrn); + struct drm_vmw_rect *rects; int i; + int ret; rects = calloc(number, sizeof(*rects)); if (!rects) @@ -224,11 +223,10 @@ VMwareCtrlDoSetTopology(ScrnInfoPtr pScrn, rects[i].h = extents[i].height; } - vmw_ioctl_update_layout(vmw, number, rects); + ret = vmwgfx_update_gui_layout(ms->fd, number, rects); free(rects); -#endif - return TRUE; + return (ret == 0); } diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c index 42d33ab..1b02a7b 100644 --- a/vmwgfx/vmwgfx_driver.c +++ b/vmwgfx/vmwgfx_driver.c @@ -61,7 +61,7 @@ #define XA_VERSION_MINOR_REQUIRED 0 #define DRM_VERSION_MAJOR_REQUIRED 2 -#define DRM_VERSION_MINOR_REQUIRED 1 +#define DRM_VERSION_MINOR_REQUIRED 3 /* * Some macros to deal with function wrapping. diff --git a/vmwgfx/vmwgfx_drm.h b/vmwgfx/vmwgfx_drm.h index bad47a7..f10f09e 100644 --- a/vmwgfx/vmwgfx_drm.h +++ b/vmwgfx/vmwgfx_drm.h @@ -27,6 +27,7 @@ #ifndef __VMWGFX_DRM_H__ #define __VMWGFX_DRM_H__ +#include <drm/drm.h> #define DRM_VMW_MAX_SURFACE_FACES 6 #define DRM_VMW_MAX_MIP_LEVELS 24 @@ -54,7 +55,7 @@ #define DRM_VMW_FENCE_EVENT 17 #define DRM_VMW_PRESENT 18 #define DRM_VMW_PRESENT_READBACK 19 - +#define DRM_VMW_UPDATE_LAYOUT 20 /*************************************************************************/ /** @@ -661,6 +662,51 @@ struct drm_vmw_fence_arg { /*************************************************************************/ /** + * DRM_VMW_FENCE_EVENT + * + * Queues an event on a fence to be delivered on the drm character device + * when the fence has signaled the DRM_VMW_FENCE_FLAG_EXEC flag. + * Optionally the approximate time when the fence signaled is + * given by the event. + */ + +/* + * The event type + */ +#define DRM_VMW_EVENT_FENCE_SIGNALED 0x80000000 + +struct drm_vmw_event_fence { + struct drm_event base; + uint64_t user_data; + uint32_t tv_sec; + uint32_t tv_usec; +}; + +/* + * Flags that may be given to the command. + */ +/* Request fence signaled time on the event. */ +#define DRM_VMW_FE_FLAG_REQ_TIME (1 << 0) + +/** + * struct drm_vmw_fence_event_arg + * + * @fence_rep: Pointer to fence_rep structure cast to uint64_t or 0 if + * the fence is not supposed to be referenced by user-space. + * @user_info: Info to be delivered with the event. + * @handle: Attach the event to this fence only. + * @flags: A set of flags as defined above. + */ +struct drm_vmw_fence_event_arg { + uint64_t fence_rep; + uint64_t user_data; + uint32_t handle; + uint32_t flags; +}; + + +/*************************************************************************/ +/** * DRM_VMW_PRESENT * * Executes an SVGA present on a given fb for a given surface. The surface @@ -720,5 +766,27 @@ struct drm_vmw_present_readback_arg { uint64_t fence_rep; }; +/*************************************************************************/ +/** + * DRM_VMW_UPDATE_LAYOUT - Update layout + * + * Updates the preferred modes and connection status for connectors. The + * command consists of one drm_vmw_update_layout_arg pointing to an array + * of num_outputs drm_vmw_rect's. + */ + +/** + * struct drm_vmw_update_layout_arg + * + * @num_outputs: number of active connectors + * @rects: pointer to array of drm_vmw_rect cast to an uint64_t + * + * Input argument to the DRM_VMW_UPDATE_LAYOUT Ioctl. + */ +struct drm_vmw_update_layout_arg { + uint32_t num_outputs; + uint32_t pad64; + uint64_t rects; +}; #endif diff --git a/vmwgfx/vmwgfx_drmi.c b/vmwgfx/vmwgfx_drmi.c index 44904a7..cc595ab 100644 --- a/vmwgfx/vmwgfx_drmi.c +++ b/vmwgfx/vmwgfx_drmi.c @@ -473,6 +473,22 @@ vmwgfx_cursor_bypass(int drm_fd, int xhot, int yhot) } int +vmwgfx_update_gui_layout(int drm_fd, unsigned int num_rects, + struct drm_vmw_rect *rects) +{ + struct drm_vmw_update_layout_arg arg; + + memset(&arg, 0, sizeof(arg)); + + arg.num_outputs = num_rects; + arg.rects = (unsigned long) rects; + + return drmCommandWrite(drm_fd, DRM_VMW_UPDATE_LAYOUT, &arg, + sizeof(arg)); +} + + +int vmwgfx_max_fb_size(int drm_fd, size_t *size) { uint64_t tmp_size; diff --git a/vmwgfx/vmwgfx_drmi.h b/vmwgfx/vmwgfx_drmi.h index ba4c440..11abf25 100644 --- a/vmwgfx/vmwgfx_drmi.h +++ b/vmwgfx/vmwgfx_drmi.h @@ -32,6 +32,7 @@ #include <xorg-server.h> #include <regionstr.h> #include <stdint.h> +#include "vmwgfx_drm.h" struct vmwgfx_dma_ctx; @@ -78,4 +79,7 @@ vmwgfx_cursor_bypass(int drm_fd, int xhot, int yhot); int vmwgfx_max_fb_size(int drm_fd, size_t *size); +int +vmwgfx_update_gui_layout(int drm_fd, unsigned int num_rects, + struct drm_vmw_rect *rects); #endif |