diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2011-05-06 10:31:18 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2011-05-06 10:33:50 -0400 |
commit | e5169e9615e8391ea369415b356168717b8f7be0 (patch) | |
tree | 6f2486f3155d9ceb780098380372132755a907e1 | |
parent | 834b84149d99526e4e7a3cfa6ba9fe81e5fb9eda (diff) | |
download | external_mesa3d-e5169e9615e8391ea369415b356168717b8f7be0.zip external_mesa3d-e5169e9615e8391ea369415b356168717b8f7be0.tar.gz external_mesa3d-e5169e9615e8391ea369415b356168717b8f7be0.tar.bz2 |
egl: Add a cursor use bit to MESA_drm_image
-rw-r--r-- | docs/MESA_drm_image.spec | 18 | ||||
-rw-r--r-- | include/EGL/eglext.h | 1 | ||||
-rw-r--r-- | include/GL/internal/dri_interface.h | 1 | ||||
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.c | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_screen.c | 10 |
5 files changed, 26 insertions, 9 deletions
diff --git a/docs/MESA_drm_image.spec b/docs/MESA_drm_image.spec index 198de3e..1150a4c 100644 --- a/docs/MESA_drm_image.spec +++ b/docs/MESA_drm_image.spec @@ -66,6 +66,7 @@ New Tokens EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x0001 EGL_DRM_BUFFER_USE_SHARE_MESA 0x0002 + EGL_DRM_BUFFER_USE_CURSOR_MESA 0x0004 Accepted in the <target> parameter of eglCreateImageKHR: @@ -89,13 +90,16 @@ Additions to the EGL 1.4 Specification: extension is EGL_DRM_BUFFER_FORMAT_ARGB32_MESA, where each pixel is a CPU-endian, 32-bit quantity, with alpha in the upper 8 bits, then red, then green, then blue. The bit values accepted by - EGL_DRM_BUFFER_USE_MESA are EGL_DRM_BUFFER_USE_SCANOUT_MESA and - EGL_DRM_BUFFER_USE_SHARE_MESA. EGL_DRM_BUFFER_USE_SCANOUT_MESA - requests that the created EGLImage should be usable as a scanout - buffer with the DRM kernel modesetting API. The - EGL_DRM_BUFFER_USE_SHARE_MESA bit requests that the EGLImage can - be shared with other processes by passing the underlying DRM - buffer name. + EGL_DRM_BUFFER_USE_MESA are EGL_DRM_BUFFER_USE_SCANOUT_MESA, + EGL_DRM_BUFFER_USE_SHARE_MESA and EGL_DRM_BUFFER_USE_CURSOR_MESA. + EGL_DRM_BUFFER_USE_SCANOUT_MESA requests that the created EGLImage + should be usable as a scanout buffer with the DRM kernel + modesetting API. EGL_DRM_BUFFER_USE_SHARE_MESA requests that the + EGLImage can be shared with other processes by passing the + underlying DRM buffer name. EGL_DRM_BUFFER_USE_CURSOR_MESA + requests that the image must be usable as a cursor with KMS. When + EGL_DRM_BUFFER_USE_CURSOR_MESA is set, width and height must both + be 64. To create a process local handle or a global DRM name for a buffer, call diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h index 9fd3eb8..9915b8c 100644 --- a/include/EGL/eglext.h +++ b/include/EGL/eglext.h @@ -131,6 +131,7 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGL /* EGL_DRM_BUFFER_USE_MESA bits */ #define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x0001 #define EGL_DRM_BUFFER_USE_SHARE_MESA 0x0002 +#define EGL_DRM_BUFFER_USE_CURSOR_MESA 0x0004 #define EGL_DRM_BUFFER_MESA 0x31D3 /* eglCreateImageKHR target */ #define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4 /* eglCreateImageKHR attribute */ diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 2fb729a..d791557 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -816,6 +816,7 @@ struct __DRIdri2ExtensionRec { #define __DRI_IMAGE_USE_SHARE 0x0001 #define __DRI_IMAGE_USE_SCANOUT 0x0002 +#define __DRI_IMAGE_USE_CURSOR 0x0004 /** * queryImage attributes diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index b03ffc3..afab679 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -1054,7 +1054,8 @@ dri2_create_drm_image_mesa(_EGLDriver *drv, _EGLDisplay *disp, valid_mask = EGL_DRM_BUFFER_USE_SCANOUT_MESA | - EGL_DRM_BUFFER_USE_SHARE_MESA; + EGL_DRM_BUFFER_USE_SHARE_MESA | + EGL_DRM_BUFFER_USE_CURSOR_MESA; if (attrs.DRMBufferUseMESA & ~valid_mask) { _eglLog(_EGL_WARNING, "bad image use bit 0x%04x", attrs.DRMBufferUseMESA & ~valid_mask); @@ -1066,6 +1067,8 @@ dri2_create_drm_image_mesa(_EGLDriver *drv, _EGLDisplay *disp, dri_use |= __DRI_IMAGE_USE_SHARE; if (attrs.DRMBufferUseMESA & EGL_DRM_BUFFER_USE_SCANOUT_MESA) dri_use |= __DRI_IMAGE_USE_SCANOUT; + if (attrs.DRMBufferUseMESA & EGL_DRM_BUFFER_USE_CURSOR_MESA) + dri_use |= __DRI_IMAGE_USE_CURSOR; dri2_img->dri_image = dri2_dpy->image->createImage(dri2_dpy->dri_screen, diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 7de0d12..5dacbb0 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -216,8 +216,16 @@ intel_create_image(__DRIscreen *screen, { __DRIimage *image; struct intel_screen *intelScreen = screen->private; + uint32_t tiling; int cpp; + tiling = I915_TILING_X; + if (use & __DRI_IMAGE_USE_CURSOR) { + if (width != 64 || height != 64) + return NULL; + tiling = I915_TILING_NONE; + } + image = CALLOC(sizeof *image); if (image == NULL) return NULL; @@ -247,7 +255,7 @@ intel_create_image(__DRIscreen *screen, cpp = _mesa_get_format_bytes(image->format); image->region = - intel_region_alloc(intelScreen, I915_TILING_X, + intel_region_alloc(intelScreen, tiling, cpp, width, height, GL_TRUE); if (image->region == NULL) { FREE(image); |