diff options
author | Steve Arnold <nerdboy@gentoo.org> | 2017-04-13 19:18:07 -0700 |
---|---|---|
committer | Steve Arnold <nerdboy@gentoo.org> | 2017-04-13 19:18:07 -0700 |
commit | cdfaf771d9510c781efbc59729d977f0f1478b1e (patch) | |
tree | b8ead29b1a543e89992cbffce6c9bdff92890d76 | |
parent | media-libs/grate: update for latest upstream tegra stuff (diff) | |
download | arm-cdfaf771d9510c781efbc59729d977f0f1478b1e.tar.gz arm-cdfaf771d9510c781efbc59729d977f0f1478b1e.tar.bz2 arm-cdfaf771d9510c781efbc59729d977f0f1478b1e.zip |
media-libs/mesa: more updates for tegra and etnaviv
Signed-off-by: Steve Arnold <nerdboy@gentoo.org>
-rw-r--r-- | media-libs/mesa/files/07_gallium-fix-build-failure-on-powerpcspe.diff | 40 | ||||
-rw-r--r-- | media-libs/mesa/files/egl-platform-mir.patch | 1035 | ||||
-rw-r--r-- | media-libs/mesa/files/i915-dont-default-to-2.1.patch | 78 | ||||
-rw-r--r-- | media-libs/mesa/mesa-12.0.6.ebuild | 479 | ||||
-rw-r--r-- | media-libs/mesa/mesa-9999.ebuild | 166 |
5 files changed, 1728 insertions, 70 deletions
diff --git a/media-libs/mesa/files/07_gallium-fix-build-failure-on-powerpcspe.diff b/media-libs/mesa/files/07_gallium-fix-build-failure-on-powerpcspe.diff new file mode 100644 index 0000000..f404454 --- /dev/null +++ b/media-libs/mesa/files/07_gallium-fix-build-failure-on-powerpcspe.diff @@ -0,0 +1,40 @@ +From a4f14e7239780b02af8d74669c5458d4b0957d4d Mon Sep 17 00:00:00 2001 +From: Roland Stigge <stigge@antcom.de> +Date: Sun, 2 Mar 2014 19:52:56 +0100 +Subject: [PATCH] gallium: fix build failure on powerpcspe + +In the case of powerpc, mesa activates some altivec instructions +that are unknown on the powerpcspe architecture (see +https://wiki.debian.org/PowerPCSPEPort), causing a build failure as the +'vand' opcode is not recognized by the assembler. + +This patch fixes this by preventing the PPC-specialcasing in case of +powerpcspe (__NO_FPRS__ is only defined there). + +https://bugs.debian.org/695746 +--- + src/gallium/include/pipe/p_config.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/gallium/include/pipe/p_config.h b/src/gallium/include/pipe/p_config.h +index d603681..8189a73 100644 +--- a/src/gallium/include/pipe/p_config.h ++++ b/src/gallium/include/pipe/p_config.h +@@ -107,12 +107,14 @@ + #endif + #endif + ++#ifndef __NO_FPRS__ + #if defined(__ppc__) || defined(__ppc64__) || defined(__PPC__) + #define PIPE_ARCH_PPC + #if defined(__ppc64__) || defined(__PPC64__) + #define PIPE_ARCH_PPC_64 + #endif + #endif ++#endif + + #if defined(__s390x__) + #define PIPE_ARCH_S390 +-- +1.9.0 + diff --git a/media-libs/mesa/files/egl-platform-mir.patch b/media-libs/mesa/files/egl-platform-mir.patch new file mode 100644 index 0000000..aa2a293 --- /dev/null +++ b/media-libs/mesa/files/egl-platform-mir.patch @@ -0,0 +1,1035 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -2037,7 +2037,9 @@ for plat in $egl_platforms; do + + android) + ;; +- ++ mir) ++ PKG_CHECK_MODULES([MIR], [mirclient mir-client-platform-mesa]) ++ ;; + *) + AC_MSG_ERROR([EGL platform '$plat' does not exist]) + ;; +@@ -2063,6 +2065,7 @@ AM_CONDITIONAL(HAVE_PLATFORM_WAYLAND, ec + AM_CONDITIONAL(HAVE_EGL_PLATFORM_DRM, echo "$egl_platforms" | grep -q 'drm') + AM_CONDITIONAL(HAVE_EGL_PLATFORM_SURFACELESS, echo "$egl_platforms" | grep -q 'surfaceless') + AM_CONDITIONAL(HAVE_EGL_PLATFORM_ANDROID, echo "$egl_platforms" | grep -q 'android') ++AM_CONDITIONAL(HAVE_EGL_PLATFORM_MIR, echo "$egl_platforms" | grep -q 'mir') + + AM_CONDITIONAL(HAVE_EGL_DRIVER_DRI2, test "x$HAVE_EGL_DRIVER_DRI2" != "x") + +--- a/include/EGL/eglplatform.h ++++ b/include/EGL/eglplatform.h +@@ -105,6 +105,13 @@ typedef struct ANativeWindow* + typedef struct egl_native_pixmap_t* EGLNativePixmapType; + typedef void* EGLNativeDisplayType; + ++#elif defined(MIR_EGL_PLATFORM) ++ ++#include <mir_toolkit/mir_client_library.h> ++typedef MirEGLNativeDisplayType EGLNativeDisplayType; ++typedef void *EGLNativePixmapType; ++typedef MirEGLNativeWindowType EGLNativeWindowType; ++ + #elif defined(__unix__) || defined(__APPLE__) + + #if defined(MESA_EGL_NO_X11_HEADERS) +--- a/include/GL/internal/dri_interface.h ++++ b/include/GL/internal/dri_interface.h +@@ -921,10 +921,12 @@ struct __DRIbufferRec { + unsigned int pitch; + unsigned int cpp; + unsigned int flags; ++ unsigned int fd; /**< Only available with DRI2_LOADER_VERSION >= 4, */ ++ /**< Only valid if name == 0 */ + }; + + #define __DRI_DRI2_LOADER "DRI_DRI2Loader" +-#define __DRI_DRI2_LOADER_VERSION 3 ++#define __DRI_DRI2_LOADER_VERSION 4 + struct __DRIdri2LoaderExtensionRec { + __DRIextension base; + +Index: mesa-12.0.2/src/egl/drivers/dri2/egl_dri2.c +=================================================================== +--- mesa-12.0.2.orig/src/egl/drivers/dri2/egl_dri2.c 2016-09-16 12:11:30.975350268 +1000 ++++ mesa-12.0.2/src/egl/drivers/dri2/egl_dri2.c 2016-09-16 13:57:41.750324740 +1000 +@@ -813,6 +813,11 @@ + ret = dri2_initialize_wayland(drv, disp); + break; + #endif ++#ifdef HAVE_MIR_PLATFORM ++ case _EGL_PLATFORM_MIR: ++ ret = dri2_initialize_mir(drv, disp); ++ break; ++#endif + #ifdef HAVE_ANDROID_PLATFORM + case _EGL_PLATFORM_ANDROID: + ret = dri2_initialize_android(drv, disp); +@@ -876,6 +881,13 @@ + } + break; + #endif ++#ifdef HAVE_MIR_PLATFORM ++ case _EGL_PLATFORM_MIR: ++ if (dri2_dpy->own_device) { ++ gbm_device_destroy(&dri2_dpy->gbm_dri->base.base); ++ } ++ break; ++#endif + #ifdef HAVE_WAYLAND_PLATFORM + case _EGL_PLATFORM_WAYLAND: + if (dri2_dpy->wl_drm) +@@ -862,7 +875,8 @@ dri2_terminate(_EGLDriver *drv, _EGLDisp + * the ones from the gbm device. As such the gbm itself is responsible + * for the cleanup. + */ +- if (disp->Platform != _EGL_PLATFORM_DRM) { ++ if (disp->Platform != _EGL_PLATFORM_DRM && ++ disp->Platform != _EGL_PLATFORM_MIR) { + for (i = 0; dri2_dpy->driver_configs[i]; i++) + free((__DRIconfig *) dri2_dpy->driver_configs[i]); + free(dri2_dpy->driver_configs); +--- a/src/egl/drivers/dri2/egl_dri2.h ++++ b/src/egl/drivers/dri2/egl_dri2.h +@@ -70,6 +70,10 @@ + + #endif /* HAVE_ANDROID_PLATFORM */ + ++#ifdef HAVE_MIR_PLATFORM ++#include <mir_toolkit/mesa/native_display.h> ++#endif ++ + #include "eglconfig.h" + #include "eglcontext.h" + #include "egldisplay.h" +@@ -217,6 +221,10 @@ struct dri2_egl_display + + int is_render_node; + int is_different_gpu; ++ ++#ifdef HAVE_MIR_PLATFORM ++ MirMesaEGLNativeDisplay *mir_disp; ++#endif + }; + + struct dri2_egl_context +@@ -263,7 +271,7 @@ struct dri2_egl_surface + struct gbm_dri_surface *gbm_surf; + #endif + +-#if defined(HAVE_WAYLAND_PLATFORM) || defined(HAVE_DRM_PLATFORM) ++#if defined(HAVE_WAYLAND_PLATFORM) || defined(HAVE_DRM_PLATFORM) || defined(HAVE_MIR_PLATFORM) + __DRIbuffer *dri_buffers[__DRI_BUFFER_COUNT]; + struct { + #ifdef HAVE_WAYLAND_PLATFORM +@@ -275,9 +283,13 @@ struct dri2_egl_surface + void *data; + int data_size; + #endif +-#ifdef HAVE_DRM_PLATFORM ++#if HAVE_DRM_PLATFORM || defined(HAVE_MIR_PLATFORM) + struct gbm_bo *bo; + #endif ++#ifdef HAVE_MIR_PLATFORM ++ int fd; ++ int buffer_age; ++#endif + int locked; + int age; + } color_buffers[4], *back, *current; +@@ -291,6 +303,10 @@ struct dri2_egl_surface + /* EGL-owned buffers */ + __DRIbuffer *local_buffers[__DRI_BUFFER_COUNT]; + #endif ++ ++#ifdef HAVE_MIR_PLATFORM ++ MirMesaEGLNativeSurface *mir_surf; ++#endif + }; + + +@@ -387,4 +403,7 @@ const __DRIconfig * + dri2_get_dri_config(struct dri2_egl_config *conf, EGLint surface_type, + EGLenum colorspace); + ++EGLBoolean ++dri2_initialize_mir(_EGLDriver *drv, _EGLDisplay *disp); ++ + #endif /* EGL_DRI2_INCLUDED */ +--- /dev/null ++++ b/src/egl/drivers/dri2/platform_mir.c +@@ -0,0 +1,637 @@ ++/* ++ * Copyright © 2012 Canonical, Inc ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a ++ * copy of this software and associated documentation files (the "Software"), ++ * to deal in the Software without restriction, including without limitation ++ * the rights to use, copy, modify, merge, publish, distribute, sublicense, ++ * and/or sell copies of the Software, and to permit persons to whom the ++ * Software is furnished to do so, subject to the following conditions: ++ * ++ * The above copyright notice and this permission notice (including the next ++ * paragraph) shall be included in all copies or substantial portions of the ++ * Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ++ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ++ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ++ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ++ * DEALINGS IN THE SOFTWARE. ++ * ++ * Authors: ++ * Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> ++ * Alexandros Frantzis <alexandros.frantzis@canonical.com> ++ */ ++ ++#include <mir_toolkit/mesa/native_display.h> ++#include <mir_toolkit/mir_native_buffer.h> ++ ++#include <stdlib.h> ++#include <string.h> ++#include <unistd.h> ++#include <xf86drm.h> ++ ++#include "egl_dri2.h" ++#include "egl_dri2_fallbacks.h" ++#include "loader.h" ++ ++static __DRIbuffer * ++dri2_get_buffers_with_format(__DRIdrawable * driDrawable, ++ int *width, int *height, ++ unsigned int *attachments, int count, ++ int *out_count, void *loaderPrivate) ++{ ++ struct dri2_egl_surface *dri2_surf = loaderPrivate; ++ struct dri2_egl_display *dri2_dpy = ++ dri2_egl_display(dri2_surf->base.Resource.Display); ++ int i; ++ ++ dri2_surf->buffer_count = 0; ++ for (i = 0; i < 2*count; i+=2) { ++ assert(attachments[i] < __DRI_BUFFER_COUNT); ++ assert(dri2_surf->buffer_count < 5); ++ ++ if (dri2_surf->dri_buffers[attachments[i]] == NULL) { ++ /* Our frame callback must keep these buffers valid */ ++ assert(attachments[i] != __DRI_BUFFER_FRONT_LEFT); ++ assert(attachments[i] != __DRI_BUFFER_BACK_LEFT); ++ ++ dri2_surf->dri_buffers[attachments[i]] = ++ dri2_dpy->dri2->allocateBuffer(dri2_dpy->dri_screen, ++ attachments[i], attachments[i+1], ++ dri2_surf->base.Width, dri2_surf->base.Height); ++ ++ if (!dri2_surf->dri_buffers[attachments[i]]) ++ continue; ++ } ++ ++ memcpy(&dri2_surf->buffers[dri2_surf->buffer_count], ++ dri2_surf->dri_buffers[attachments[i]], ++ sizeof(__DRIbuffer)); ++ ++ dri2_surf->buffer_count++; ++ } ++ ++ assert(dri2_surf->base.Type == EGL_PIXMAP_BIT || ++ dri2_surf->dri_buffers[__DRI_BUFFER_BACK_LEFT]); ++ ++ *out_count = dri2_surf->buffer_count; ++ if (dri2_surf->buffer_count == 0) ++ return NULL; ++ ++ *width = dri2_surf->base.Width; ++ *height = dri2_surf->base.Height; ++ ++ return dri2_surf->buffers; ++} ++ ++static __DRIbuffer * ++dri2_get_buffers(__DRIdrawable * driDrawable, ++ int *width, int *height, ++ unsigned int *attachments, int count, ++ int *out_count, void *loaderPrivate) ++{ ++ unsigned int *attachments_with_format; ++ __DRIbuffer *buffer; ++ const unsigned int format = 32; ++ int i; ++ ++ attachments_with_format = calloc(count * 2, sizeof(unsigned int)); ++ if (!attachments_with_format) { ++ *out_count = 0; ++ return NULL; ++ } ++ ++ for (i = 0; i < count; ++i) { ++ attachments_with_format[2*i] = attachments[i]; ++ attachments_with_format[2*i + 1] = format; ++ } ++ ++ buffer = ++ dri2_get_buffers_with_format(driDrawable, ++ width, height, ++ attachments_with_format, count, ++ out_count, loaderPrivate); ++ ++ free(attachments_with_format); ++ ++ return buffer; ++} ++ ++static int ++dri2_image_get_buffers(__DRIdrawable *driDrawable, ++ unsigned int format, ++ uint32_t *stamp, ++ void *loaderPrivate, ++ uint32_t buffer_mask, ++ struct __DRIimageList *buffers) ++{ ++ struct dri2_egl_surface *dri2_surf = loaderPrivate; ++ ++ if (buffer_mask & __DRI_IMAGE_BUFFER_BACK) { ++ if (!dri2_surf->back) ++ return 0; ++ ++ buffers->back = ((struct gbm_dri_bo *)dri2_surf->back->bo)->image; ++ buffers->image_mask = __DRI_IMAGE_BUFFER_BACK; ++ ++ return 1; ++ } ++ ++ return 0; ++} ++ ++static void ++dri2_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate) ++{ ++ (void) driDrawable; ++ ++ /* FIXME: Does EGL support front buffer rendering at all? */ ++ ++#if 0 ++ struct dri2_egl_surface *dri2_surf = loaderPrivate; ++ ++ dri2WaitGL(dri2_surf); ++#else ++ (void) loaderPrivate; ++#endif ++} ++ ++static struct gbm_bo *create_gbm_bo_from_buffer(struct gbm_device* gbm_dev, ++ MirBufferPackage *package) ++{ ++ struct gbm_import_fd_data data; ++ ++ data.fd = package->fd[0]; ++ data.width = package->width; ++ data.height = package->height; ++ data.format = GBM_FORMAT_ARGB8888; /* TODO: Use mir surface format */ ++ data.stride = package->stride; ++ ++ return gbm_bo_import(gbm_dev, GBM_BO_IMPORT_FD, &data, GBM_BO_USE_RENDERING); ++} ++ ++static ssize_t find_cached_buffer_with_fd(struct dri2_egl_surface *dri2_surf, ++ int fd) ++{ ++ ssize_t i; ++ ++ for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) { ++ if (dri2_surf->color_buffers[i].fd == fd) ++ return i; ++ } ++ ++ return -1; ++} ++ ++static void cache_buffer(struct dri2_egl_surface *dri2_surf, size_t slot, ++ MirBufferPackage *buffer_package) ++{ ++ struct dri2_egl_display *dri2_dpy = ++ dri2_egl_display(dri2_surf->base.Resource.Display); ++ ++ if (dri2_surf->color_buffers[slot].bo != NULL) ++ gbm_bo_destroy(dri2_surf->color_buffers[slot].bo); ++ ++ dri2_surf->color_buffers[slot].bo = create_gbm_bo_from_buffer( ++ &dri2_dpy->gbm_dri->base.base, ++ buffer_package); ++ ++ dri2_surf->color_buffers[slot].fd = buffer_package->fd[0]; ++} ++ ++static size_t find_best_cache_slot(struct dri2_egl_surface *dri2_surf) ++{ ++ size_t i; ++ size_t start_slot = 0; ++ ++ /* ++ * If we have a back buffer, start searching after it to ensure ++ * we don't reuse the slot too soon. ++ */ ++ if (dri2_surf->back != NULL) { ++ start_slot = dri2_surf->back - dri2_surf->color_buffers; ++ start_slot = (start_slot + 1) % ARRAY_SIZE(dri2_surf->color_buffers); ++ } ++ ++ /* Try to find an empty slot */ ++ for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) { ++ size_t slot = (start_slot + i) % ARRAY_SIZE(dri2_surf->color_buffers); ++ if (dri2_surf->color_buffers[slot].bo == NULL) ++ return slot; ++ } ++ ++ /* If we don't have an empty slot, use the start slot */ ++ return start_slot; ++} ++ ++static void update_cached_buffer_ages(struct dri2_egl_surface *dri2_surf, ++ size_t used_slot) ++{ ++ /* ++ * If 3 (Mir surfaces are triple buffered at most) other buffers have been ++ * used since a buffer was used, we probably won't need this buffer again. ++ */ ++ static const int destruction_age = 3; ++ size_t i; ++ ++ for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) { ++ if (dri2_surf->color_buffers[i].bo != NULL) { ++ if (i == used_slot) { ++ dri2_surf->color_buffers[i].age = 0; ++ } ++ else { ++ ++dri2_surf->color_buffers[i].age; ++ if (dri2_surf->color_buffers[i].age == destruction_age) { ++ gbm_bo_destroy(dri2_surf->color_buffers[i].bo); ++ dri2_surf->color_buffers[i].bo = NULL; ++ dri2_surf->color_buffers[i].fd = -1; ++ } ++ } ++ } ++ } ++} ++ ++static void clear_cached_buffers(struct dri2_egl_surface *dri2_surf) ++{ ++ size_t i; ++ for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) { ++ if (dri2_surf->color_buffers[i].bo != NULL) ++ gbm_bo_destroy(dri2_surf->color_buffers[i].bo); ++ dri2_surf->color_buffers[i].bo = NULL; ++ dri2_surf->color_buffers[i].fd = -1; ++ dri2_surf->color_buffers[i].age = 0; ++ } ++} ++ ++static EGLBoolean ++mir_advance_colour_buffer(struct dri2_egl_surface *dri2_surf) ++{ ++ MirBufferPackage buffer_package; ++ ssize_t buf_slot = -1; ++ ++ if(!dri2_surf->mir_surf->surface_advance_buffer(dri2_surf->mir_surf, &buffer_package)) ++ return EGL_FALSE; ++ ++ /* We expect no data items, and (for the moment) one PRIME fd */ ++ assert(buffer_package.data_items == 0); ++ assert(buffer_package.fd_items == 1); ++ ++ /* Mir ABIs prior to release 0.1.2 lacked width and height */ ++ if (buffer_package.width && buffer_package.height) { ++ dri2_surf->base.Width = buffer_package.width; ++ dri2_surf->base.Height = buffer_package.height; ++ } ++ ++ buf_slot = find_cached_buffer_with_fd(dri2_surf, buffer_package.fd[0]); ++ if (buf_slot != -1) { ++ /* ++ * If we get a new buffer with an fd of a previously cached buffer, ++ * replace the old buffer in the cache... ++ */ ++ if (buffer_package.age == 0) ++ cache_buffer(dri2_surf, buf_slot, &buffer_package); ++ /* ... otherwise just reuse the existing cached buffer */ ++ } ++ else { ++ /* We got a new buffer with an fd that's not in the cache, so add it */ ++ buf_slot = find_best_cache_slot(dri2_surf); ++ cache_buffer(dri2_surf, buf_slot, &buffer_package); ++ } ++ ++ update_cached_buffer_ages(dri2_surf, buf_slot); ++ ++ dri2_surf->back = &dri2_surf->color_buffers[buf_slot]; ++ dri2_surf->back->buffer_age = buffer_package.age; ++ dri2_surf->dri_buffers[__DRI_BUFFER_BACK_LEFT]->name = 0; ++ dri2_surf->dri_buffers[__DRI_BUFFER_BACK_LEFT]->fd = buffer_package.fd[0]; ++ dri2_surf->dri_buffers[__DRI_BUFFER_BACK_LEFT]->pitch = buffer_package.stride; ++ return EGL_TRUE; ++} ++ ++/** ++ * Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface(). ++ */ ++static _EGLSurface * ++dri2_create_mir_window_surface(_EGLDriver *drv, _EGLDisplay *disp, ++ _EGLConfig *conf, EGLNativeWindowType window, ++ const EGLint *attrib_list) ++{ ++ struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); ++ struct dri2_egl_config *dri2_conf = dri2_egl_config(conf); ++ struct dri2_egl_surface *dri2_surf; ++ const __DRIconfig *config; ++ MirSurfaceParameters surf_params; ++ ++ (void) drv; ++ ++ dri2_surf = calloc(1, sizeof *dri2_surf); ++ if (!dri2_surf) { ++ _eglError(EGL_BAD_ALLOC, "dri2_create_surface"); ++ return NULL; ++ } ++ ++ if (!_eglInitSurface(&dri2_surf->base, disp, EGL_WINDOW_BIT, conf, attrib_list)) ++ goto cleanup_surf; ++ ++ dri2_surf->mir_surf = window; ++ if (!dri2_surf->mir_surf->surface_get_parameters(dri2_surf->mir_surf, &surf_params)) ++ goto cleanup_surf; ++ ++ dri2_surf->base.Width = surf_params.width; ++ dri2_surf->base.Height = surf_params.height; ++ ++ dri2_surf->dri_buffers[__DRI_BUFFER_FRONT_LEFT] = ++ calloc(sizeof(*dri2_surf->dri_buffers[0]), 1); ++ dri2_surf->dri_buffers[__DRI_BUFFER_BACK_LEFT] = ++ calloc(sizeof(*dri2_surf->dri_buffers[0]), 1); ++ ++ dri2_surf->dri_buffers[__DRI_BUFFER_BACK_LEFT]->attachment = ++ __DRI_BUFFER_BACK_LEFT; ++ /* We only do ARGB 8888 for the moment */ ++ dri2_surf->dri_buffers[__DRI_BUFFER_BACK_LEFT]->cpp = 4; ++ ++ clear_cached_buffers(dri2_surf); ++ ++ if(!mir_advance_colour_buffer(dri2_surf)) ++ goto cleanup_surf; ++ ++ config = dri2_get_dri_config(dri2_conf, EGL_WINDOW_BIT, ++ dri2_surf->base.GLColorspace); ++ ++ if (dri2_dpy->gbm_dri) { ++ struct gbm_dri_surface *surf = malloc(sizeof *surf); ++ ++ dri2_surf->gbm_surf = surf; ++ surf->base.gbm = &dri2_dpy->gbm_dri->base.base; ++ surf->base.width = dri2_surf->base.Width; ++ surf->base.height = dri2_surf->base.Height; ++ surf->base.format = GBM_FORMAT_ARGB8888; ++ surf->base.flags = GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING; ++ surf->dri_private = dri2_surf; ++ ++ dri2_surf->dri_drawable = ++ (*dri2_dpy->dri2->createNewDrawable) (dri2_dpy->dri_screen, ++ config, ++ dri2_surf->gbm_surf); ++ } ++ else { ++ dri2_surf->dri_drawable = ++ (*dri2_dpy->dri2->createNewDrawable) (dri2_dpy->dri_screen, ++ config, ++ dri2_surf); ++ } ++ ++ if (dri2_surf->dri_drawable == NULL) { ++ _eglError(EGL_BAD_ALLOC, "dri2->createNewDrawable"); ++ } ++ ++ return &dri2_surf->base; ++ ++cleanup_surf: ++ free(dri2_surf); ++ return NULL; ++} ++ ++static _EGLSurface * ++dri2_mir_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay *disp, ++ _EGLConfig *conf, void *native_window, ++ const EGLint *attrib_list) ++{ ++ _eglError(EGL_BAD_PARAMETER, "cannot create EGL pixmap surfaces on mir"); ++ return NULL; ++} ++ ++ ++static EGLBoolean ++dri2_destroy_mir_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf) ++{ ++ struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); ++ struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf); ++ int i; ++ ++ (void) drv; ++ ++ if (!_eglPutSurface(surf)) ++ return EGL_TRUE; ++ ++ clear_cached_buffers(dri2_surf); ++ ++ (*dri2_dpy->core->destroyDrawable)(dri2_surf->dri_drawable); ++ ++ for (i = 0; i < __DRI_BUFFER_COUNT; ++i) { ++ if (dri2_surf->dri_buffers[i]) { ++ if ((i == __DRI_BUFFER_FRONT_LEFT) || ++ (i == __DRI_BUFFER_BACK_LEFT)) { ++ free(dri2_surf->dri_buffers[i]); ++ } ++ else { ++ dri2_dpy->dri2->releaseBuffer(dri2_dpy->dri_screen, ++ dri2_surf->dri_buffers[i]); ++ } ++ } ++ } ++ ++ free(dri2_surf->gbm_surf); ++ free(surf); ++ ++ return EGL_TRUE; ++} ++ ++/** ++ * Called via eglSwapInterval(), drv->API.SwapInterval(). ++ */ ++static EGLBoolean ++dri2_set_swap_interval(_EGLDriver *drv, _EGLDisplay *disp, ++ _EGLSurface *surf, EGLint interval) ++{ ++ struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf); ++ if(!dri2_surf->mir_surf->surface_set_swapinterval(dri2_surf->mir_surf, interval)) ++ return EGL_FALSE; ++ return EGL_TRUE; ++} ++ ++/** ++ * Called via eglSwapBuffers(), drv->API.SwapBuffers(). ++ */ ++static EGLBoolean ++dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw) ++{ ++ struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); ++ struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw); ++ ++ (*dri2_dpy->flush->flush)(dri2_surf->dri_drawable); ++ ++ int rc = mir_advance_colour_buffer(dri2_surf); ++ ++ (*dri2_dpy->flush->invalidate)(dri2_surf->dri_drawable); ++ ++ return rc; ++} ++ ++static int ++dri2_mir_authenticate(_EGLDisplay *disp, uint32_t id) ++{ ++ return 0; ++} ++ ++static _EGLImage * ++dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx, ++ EGLClientBuffer buffer, const EGLint *attr_list) ++{ ++ struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); ++ struct gbm_dri_bo *dri_bo = gbm_dri_bo((struct gbm_bo *) buffer); ++ struct dri2_egl_image *dri2_img; ++ ++ dri2_img = malloc(sizeof *dri2_img); ++ if (!dri2_img) { ++ _eglError(EGL_BAD_ALLOC, "dri2_create_image_khr_pixmap"); ++ return NULL; ++ } ++ ++ if (!_eglInitImage(&dri2_img->base, disp)) { ++ free(dri2_img); ++ return NULL; ++ } ++ ++ ++ dri2_img->dri_image = dri2_dpy->image->dupImage(dri_bo->image, dri2_img); ++ if (dri2_img->dri_image == NULL) { ++ free(dri2_img); ++ _eglError(EGL_BAD_ALLOC, "dri2_create_image_khr_pixmap"); ++ return NULL; ++ } ++ ++ return &dri2_img->base; ++} ++ ++static _EGLImage * ++dri2_mir_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp, ++ _EGLContext *ctx, EGLenum target, ++ EGLClientBuffer buffer, const EGLint *attr_list) ++{ ++ (void) drv; ++ ++ switch (target) { ++ case EGL_NATIVE_PIXMAP_KHR: ++ return dri2_create_image_khr_pixmap(disp, ctx, buffer, attr_list); ++ default: ++ return dri2_create_image_khr(drv, disp, ctx, target, buffer, attr_list); ++ } ++} ++ ++static EGLint ++dri2_mir_query_buffer_age(_EGLDriver *drv, _EGLDisplay *dpy, ++ _EGLSurface *surf) ++{ ++ struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf); ++ if (dri2_surf->back) ++ { ++ return dri2_surf->back->buffer_age; ++ } ++ return 0; ++} ++ ++static struct dri2_egl_display_vtbl dri2_mir_display_vtbl = { ++ .authenticate = dri2_mir_authenticate, ++ .create_window_surface = dri2_create_mir_window_surface, ++ .create_pixmap_surface = dri2_mir_create_pixmap_surface, ++ .create_pbuffer_surface = dri2_fallback_create_pbuffer_surface, ++ .destroy_surface = dri2_destroy_mir_surface, ++ .create_image = dri2_mir_create_image_khr, ++ .swap_interval = dri2_set_swap_interval, ++ .swap_buffers = dri2_swap_buffers, ++ .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage, ++ .swap_buffers_region = dri2_fallback_swap_buffers_region, ++ .post_sub_buffer = dri2_fallback_post_sub_buffer, ++ .copy_buffers = dri2_fallback_copy_buffers, ++ .query_buffer_age = dri2_mir_query_buffer_age, ++ .create_wayland_buffer_from_image = dri2_fallback_create_wayland_buffer_from_image, ++ .get_sync_values = dri2_fallback_get_sync_values, ++ .get_dri_drawable = dri2_surface_get_dri_drawable, ++}; ++ ++EGLBoolean ++dri2_initialize_mir(_EGLDriver *drv, _EGLDisplay *disp) ++{ ++ struct dri2_egl_display *dri2_dpy; ++ struct gbm_device *gbm = NULL; ++ MirPlatformPackage platform; ++ const __DRIconfig *config; ++ static const unsigned int argb_masks[4] = ++ { 0xff0000, 0xff00, 0xff, 0xff000000 }; ++ uint32_t types; ++ int i; ++ ++ loader_set_logger(_eglLog); ++ ++ dri2_dpy = calloc(1, sizeof *dri2_dpy); ++ if (!dri2_dpy) ++ return _eglError(EGL_BAD_ALLOC, "eglInitialize"); ++ ++ disp->DriverData = (void *) dri2_dpy; ++ dri2_dpy->mir_disp = disp->PlatformDisplay; ++ dri2_dpy->mir_disp->display_get_platform(dri2_dpy->mir_disp, &platform); ++ dri2_dpy->fd = platform.fd[0]; ++ dri2_dpy->device_name = loader_get_device_name_for_fd(dri2_dpy->fd); ++ ++ /* ++ * At the moment, a pointer to gbm_device is the first and only ++ * information optionally contained in platform.data[]. ++ */ ++ if (platform.data_items == 0) { ++ dri2_dpy->own_device = 1; ++ dri2_dpy->fd = dup(dri2_dpy->fd); ++ gbm = gbm_create_device(dri2_dpy->fd); ++ if (gbm == NULL) ++ goto cleanup_dpy; ++ } ++ else { ++ gbm = *(struct gbm_device**)platform.data; ++ } ++ ++ if (gbm) { ++ struct gbm_dri_device *gbm_dri = gbm_dri_device(gbm); ++ ++ dri2_dpy->gbm_dri = gbm_dri; ++ dri2_dpy->driver_name = strdup(gbm_dri->base.driver_name); ++ dri2_dpy->dri_screen = gbm_dri->screen; ++ dri2_dpy->core = gbm_dri->core; ++ dri2_dpy->dri2 = gbm_dri->dri2; ++ dri2_dpy->image = gbm_dri->image; ++ dri2_dpy->flush = gbm_dri->flush; ++ dri2_dpy->driver_configs = gbm_dri->driver_configs; ++ ++ gbm_dri->lookup_image = dri2_lookup_egl_image; ++ gbm_dri->lookup_user_data = disp; ++ ++ gbm_dri->get_buffers = dri2_get_buffers; ++ gbm_dri->flush_front_buffer = dri2_flush_front_buffer; ++ gbm_dri->get_buffers_with_format = dri2_get_buffers_with_format; ++ gbm_dri->image_get_buffers = dri2_image_get_buffers; ++ ++ dri2_setup_screen(disp); ++ } ++ ++ types = EGL_WINDOW_BIT; ++ for (i = 0; dri2_dpy->driver_configs[i]; i++) { ++ config = dri2_dpy->driver_configs[i]; ++ dri2_add_config(disp, config, i + 1, types, NULL, argb_masks); ++ } ++ ++ disp->Extensions.EXT_buffer_age = EGL_TRUE; ++ disp->Extensions.EXT_swap_buffers_with_damage = EGL_FALSE; ++ disp->Extensions.KHR_image_pixmap = EGL_TRUE; ++ ++ dri2_dpy->vtbl = &dri2_mir_display_vtbl; ++ ++ return EGL_TRUE; ++ ++ cleanup_dpy: ++ free(dri2_dpy); ++ ++ return EGL_FALSE; ++} +--- a/src/egl/main/egldisplay.c ++++ b/src/egl/main/egldisplay.c +@@ -56,7 +56,10 @@ + #ifdef HAVE_DRM_PLATFORM + #include <gbm.h> + #endif +- ++#ifdef HAVE_MIR_PLATFORM ++#include <dlfcn.h> ++#include <mir_toolkit/mesa/native_display.h> ++#endif + + /** + * Map --with-egl-platforms names to platform types. +@@ -71,6 +74,7 @@ static const struct { + { _EGL_PLATFORM_ANDROID, "android" }, + { _EGL_PLATFORM_HAIKU, "haiku" }, + { _EGL_PLATFORM_SURFACELESS, "surfaceless" }, ++ { _EGL_PLATFORM_MIR, "mir" } + }; + + +@@ -130,6 +134,47 @@ _eglPointerIsDereferencable(void *p) + #endif + } + ++#ifdef HAVE_MIR_PLATFORM ++static EGLBoolean ++_mir_display_is_valid(EGLNativeDisplayType nativeDisplay) ++{ ++ typedef int (*MirEGLNativeDisplayIsValidFunc)(MirMesaEGLNativeDisplay*); ++ ++ void *lib; ++ MirEGLNativeDisplayIsValidFunc general_check; ++ MirEGLNativeDisplayIsValidFunc client_check; ++ MirEGLNativeDisplayIsValidFunc server_check; ++ EGLBoolean is_valid = EGL_FALSE; ++ ++ lib = dlopen(NULL, RTLD_LAZY); ++ if (lib == NULL) ++ return EGL_FALSE; ++ ++ general_check = (MirEGLNativeDisplayIsValidFunc) dlsym(lib, "mir_egl_mesa_display_is_valid"); ++ client_check = (MirEGLNativeDisplayIsValidFunc) dlsym(lib, "mir_client_mesa_egl_native_display_is_valid"); ++ server_check = (MirEGLNativeDisplayIsValidFunc) dlsym(lib, "mir_server_mesa_egl_native_display_is_valid"); ++ ++ if (general_check != NULL && ++ general_check((MirMesaEGLNativeDisplay *)nativeDisplay)) ++ { ++ is_valid = EGL_TRUE; ++ } ++ else if (client_check != NULL && ++ client_check((MirMesaEGLNativeDisplay *)nativeDisplay)) ++ { ++ is_valid = EGL_TRUE; ++ } ++ else if (server_check != NULL && ++ server_check((MirMesaEGLNativeDisplay *)nativeDisplay)) ++ { ++ is_valid = EGL_TRUE; ++ } ++ ++ dlclose(lib); ++ ++ return is_valid; ++} ++#endif + + /** + * Try detecting native platform with the help of native display characteristcs. +@@ -140,6 +185,11 @@ _eglNativePlatformDetectNativeDisplay(vo + if (nativeDisplay == EGL_DEFAULT_DISPLAY) + return _EGL_INVALID_PLATFORM; + ++#ifdef HAVE_MIR_PLATFORM ++ if (_mir_display_is_valid(nativeDisplay)) ++ return _EGL_PLATFORM_MIR; ++#endif ++ + if (_eglPointerIsDereferencable(nativeDisplay)) { + void *first_pointer = *(void **) nativeDisplay; + +@@ -178,7 +228,7 @@ _eglNativePlatformDetectNativeDisplay(vo + _EGLPlatformType + _eglGetNativePlatform(void *nativeDisplay) + { +- static _EGLPlatformType native_platform = _EGL_INVALID_PLATFORM; ++ _EGLPlatformType native_platform = _EGL_INVALID_PLATFORM; + char *detection_method = NULL; + + if (native_platform == _EGL_INVALID_PLATFORM) { +--- a/src/egl/main/egldisplay.h ++++ b/src/egl/main/egldisplay.h +@@ -50,6 +50,7 @@ enum _egl_platform_type { + _EGL_PLATFORM_ANDROID, + _EGL_PLATFORM_HAIKU, + _EGL_PLATFORM_SURFACELESS, ++ _EGL_PLATFORM_MIR, + + _EGL_NUM_PLATFORMS, + _EGL_INVALID_PLATFORM = -1 +--- a/src/gallium/state_trackers/dri/dri2.c ++++ b/src/gallium/state_trackers/dri/dri2.c +@@ -582,13 +582,21 @@ dri2_allocate_textures(struct dri_contex + templ.height0 = dri_drawable->h; + templ.format = format; + templ.bind = bind; +- whandle.handle = buf->name; + whandle.stride = buf->pitch; + whandle.offset = 0; +- if (screen->can_share_buffer) +- whandle.type = DRM_API_HANDLE_TYPE_SHARED; +- else ++ if (screen->can_share_buffer) { ++ if (buf->name != 0) { ++ whandle.type = DRM_API_HANDLE_TYPE_SHARED; ++ whandle.handle = buf->name; ++ } else { ++ whandle.type = DRM_API_HANDLE_TYPE_FD; ++ whandle.handle = buf->fd; ++ } ++ } else { + whandle.type = DRM_API_HANDLE_TYPE_KMS; ++ whandle.handle = buf->name; ++ } ++ + drawable->textures[statt] = + screen->base.screen->resource_from_handle(screen->base.screen, + &templ, &whandle, +--- a/src/gbm/backends/dri/gbm_dri.c ++++ b/src/gbm/backends/dri/gbm_dri.c +@@ -203,7 +203,7 @@ static const __DRIimageLookupExtension i + }; + + static const __DRIdri2LoaderExtension dri2_loader_extension = { +- .base = { __DRI_DRI2_LOADER, 3 }, ++ .base = { __DRI_DRI2_LOADER, 4 }, + + .getBuffers = dri_get_buffers, + .flushFrontBuffer = dri_flush_front_buffer, +@@ -642,6 +642,43 @@ gbm_dri_to_gbm_format(uint32_t dri_forma + return ret; + } + ++static uint32_t ++gbm_to_dri_format(uint32_t gbm_format) ++{ ++ uint32_t dri_format = 0; ++ ++ switch (gbm_format) { ++ case GBM_FORMAT_RGB565: ++ dri_format =__DRI_IMAGE_FORMAT_RGB565; ++ break; ++ case GBM_FORMAT_XRGB8888: ++ case GBM_BO_FORMAT_XRGB8888: ++ dri_format = __DRI_IMAGE_FORMAT_XRGB8888; ++ break; ++ case GBM_FORMAT_ARGB8888: ++ case GBM_BO_FORMAT_ARGB8888: ++ dri_format = __DRI_IMAGE_FORMAT_ARGB8888; ++ break; ++ case GBM_FORMAT_ABGR8888: ++ dri_format = __DRI_IMAGE_FORMAT_ABGR8888; ++ break; ++ case GBM_FORMAT_XBGR8888: ++ dri_format = __DRI_IMAGE_FORMAT_XBGR8888; ++ break; ++ case GBM_FORMAT_ARGB2101010: ++ dri_format = __DRI_IMAGE_FORMAT_ARGB2101010; ++ break; ++ case GBM_FORMAT_XRGB2101010: ++ dri_format = __DRI_IMAGE_FORMAT_XRGB2101010; ++ break; ++ default: ++ dri_format = __DRI_IMAGE_FORMAT_NONE; ++ break; ++ } ++ ++ return dri_format; ++} ++ + static struct gbm_bo * + gbm_dri_bo_import(struct gbm_device *gbm, + uint32_t type, void *buffer, uint32_t usage) +@@ -866,34 +903,7 @@ gbm_dri_bo_create(struct gbm_device *gbm + bo->base.base.height = height; + bo->base.base.format = format; + +- switch (format) { +- case GBM_FORMAT_RGB565: +- dri_format =__DRI_IMAGE_FORMAT_RGB565; +- break; +- case GBM_FORMAT_XRGB8888: +- case GBM_BO_FORMAT_XRGB8888: +- dri_format = __DRI_IMAGE_FORMAT_XRGB8888; +- break; +- case GBM_FORMAT_ARGB8888: +- case GBM_BO_FORMAT_ARGB8888: +- dri_format = __DRI_IMAGE_FORMAT_ARGB8888; +- break; +- case GBM_FORMAT_ABGR8888: +- dri_format = __DRI_IMAGE_FORMAT_ABGR8888; +- break; +- case GBM_FORMAT_XBGR8888: +- dri_format = __DRI_IMAGE_FORMAT_XBGR8888; +- break; +- case GBM_FORMAT_ARGB2101010: +- dri_format = __DRI_IMAGE_FORMAT_ARGB2101010; +- break; +- case GBM_FORMAT_XRGB2101010: +- dri_format = __DRI_IMAGE_FORMAT_XRGB2101010; +- break; +- default: +- errno = EINVAL; +- goto failed; +- } ++ dri_format = gbm_to_dri_format(format); + + if (usage & GBM_BO_USE_SCANOUT) + dri_use |= __DRI_IMAGE_USE_SCANOUT; +--- a/src/egl/Makefile.am ++++ b/src/egl/Makefile.am +@@ -89,6 +89,12 @@ AM_CFLAGS += -DHAVE_ANDROID_PLATFORM + dri2_backend_FILES += drivers/dri2/platform_android.c + endif + ++if HAVE_EGL_PLATFORM_MIR ++AM_CFLAGS += -DHAVE_MIR_PLATFORM ++AM_CFLAGS += $(MIR_CFLAGS) ++dri2_backend_FILES += drivers/dri2/platform_mir.c ++endif ++ + if HAVE_EGL_DRIVER_DRI2 + AM_CFLAGS += \ + -I$(top_srcdir)/src/loader \ diff --git a/media-libs/mesa/files/i915-dont-default-to-2.1.patch b/media-libs/mesa/files/i915-dont-default-to-2.1.patch new file mode 100644 index 0000000..fb40ebb --- /dev/null +++ b/media-libs/mesa/files/i915-dont-default-to-2.1.patch @@ -0,0 +1,78 @@ +This is a revert of http://cgit.freedesktop.org/mesa/mesa/commit/?id=97217a40f97cdeae0304798b607f704deb0c3558 + +i915: Always enable GL 2.0 support. +There's no point in shipping a non-GL2 driver today. + +From upstream mesa. + +--- a/src/mesa/drivers/dri/i915/intel_extensions.c ++++ b/src/mesa/drivers/dri/i915/intel_extensions.c +@@ -92,8 +92,12 @@ intelInitExtensions(struct gl_context *c + ctx->Extensions.ATI_separate_stencil = true; + ctx->Extensions.ATI_texture_env_combine3 = true; + ctx->Extensions.NV_texture_env_combine4 = true; +- ctx->Extensions.ARB_fragment_shader = true; +- ctx->Extensions.ARB_occlusion_query = true; ++ ++ if (driQueryOptionb(&intel->optionCache, "fragment_shader")) ++ ctx->Extensions.ARB_fragment_shader = true; ++ ++ if (driQueryOptionb(&intel->optionCache, "stub_occlusion_query")) ++ ctx->Extensions.ARB_occlusion_query = true; + } + + if (intel->ctx.Mesa_DXTn +--- a/src/mesa/drivers/dri/i915/intel_screen.c ++++ b/src/mesa/drivers/dri/i915/intel_screen.c +@@ -62,6 +62,10 @@ DRI_CONF_BEGIN + DRI_CONF_DESC(en, "Enable early Z in classic mode (unstable, 945-only).") + DRI_CONF_OPT_END + ++ DRI_CONF_OPT_BEGIN_B(fragment_shader, "true") ++ DRI_CONF_DESC(en, "Enable limited ARB_fragment_shader support on 915/945.") ++ DRI_CONF_OPT_END ++ + DRI_CONF_SECTION_END + DRI_CONF_SECTION_QUALITY + DRI_CONF_FORCE_S3TC_ENABLE("false") +@@ -75,6 +79,10 @@ DRI_CONF_BEGIN + DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS("false") + DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED("false") + ++ DRI_CONF_OPT_BEGIN_B(stub_occlusion_query, "false") ++ DRI_CONF_DESC(en, "Enable stub ARB_occlusion_query support on 915/945.") ++ DRI_CONF_OPT_END ++ + DRI_CONF_OPT_BEGIN_B(shader_precompile, "true") + DRI_CONF_DESC(en, "Perform code generation at shader link time.") + DRI_CONF_OPT_END +@@ -1122,12 +1130,26 @@ set_max_gl_versions(struct intel_screen + __DRIscreen *psp = screen->driScrnPriv; + + switch (screen->gen) { +- case 3: ++ case 3: { ++ bool has_fragment_shader = driQueryOptionb(&screen->optionCache, "fragment_shader"); ++ bool has_occlusion_query = driQueryOptionb(&screen->optionCache, "stub_occlusion_query"); ++ + psp->max_gl_core_version = 0; + psp->max_gl_es1_version = 11; +- psp->max_gl_compat_version = 21; +- psp->max_gl_es2_version = 20; ++ ++ if (has_fragment_shader && has_occlusion_query) { ++ psp->max_gl_compat_version = 21; ++ } else { ++ psp->max_gl_compat_version = 14; ++ } ++ ++ if (has_fragment_shader) { ++ psp->max_gl_es2_version = 20; ++ } else { ++ psp->max_gl_es2_version = 0; ++ } + break; ++ } + case 2: + psp->max_gl_core_version = 0; + psp->max_gl_compat_version = 13; diff --git a/media-libs/mesa/mesa-12.0.6.ebuild b/media-libs/mesa/mesa-12.0.6.ebuild new file mode 100644 index 0000000..ca1f586 --- /dev/null +++ b/media-libs/mesa/mesa-12.0.6.ebuild @@ -0,0 +1,479 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +EGIT_REPO_URI="git://anongit.freedesktop.org/mesa/mesa" + +if [[ ${PV} = 9999 ]]; then + GIT_ECLASS="git-r3" + EXPERIMENTAL="true" +fi + +PYTHON_COMPAT=( python2_7 ) + +inherit autotools multilib-minimal python-any-r1 pax-utils ${GIT_ECLASS} + +OPENGL_DIR="xorg-x11" + +MY_P="${P/_/-}" +FOLDER="${PV/_rc*/}" + +DESCRIPTION="OpenGL-like graphic library for Linux" +HOMEPAGE="http://mesa3d.sourceforge.net/" + +if [[ $PV == 9999 ]]; then + SRC_URI="" + KEYWORDS="" +else + SRC_URI="ftp://ftp.freedesktop.org/pub/mesa/${FOLDER}/${MY_P}.tar.xz" + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~sparc-solaris ~x64-solaris ~x86-solaris" +fi + +LICENSE="MIT" +SLOT="0" +RESTRICT="!bindist? ( bindist )" + +INTEL_CARDS="i915 i965 ilo intel" +RADEON_CARDS="r100 r200 r300 r600 radeon radeonsi" +VIDEO_CARDS="${INTEL_CARDS} ${RADEON_CARDS} freedreno imx nouveau vc4 vivante vmware" +for card in ${VIDEO_CARDS}; do + IUSE_VIDEO_CARDS+=" video_cards_${card}" +done + +IUSE="${IUSE_VIDEO_CARDS} + bindist +classic d3d9 debug +dri3 +egl +gallium +gbm gles1 gles2 +llvm + +nptl opencl osmesa pax_kernel openmax pic selinux +udev vaapi valgrind + vdpau wayland xvmc xa kernel_FreeBSD" + +REQUIRED_USE=" + d3d9? ( dri3 gallium ) + llvm? ( gallium ) + opencl? ( gallium llvm ) + openmax? ( gallium ) + gles1? ( egl ) + gles2? ( egl ) + vaapi? ( gallium ) + vdpau? ( gallium ) + wayland? ( egl gbm ) + xa? ( gallium ) + video_cards_freedreno? ( gallium ) + video_cards_intel? ( classic ) + video_cards_i915? ( || ( classic gallium ) ) + video_cards_i965? ( classic ) + video_cards_ilo? ( gallium ) + video_cards_imx? ( gallium ) + video_cards_nouveau? ( || ( classic gallium ) ) + video_cards_radeon? ( || ( classic gallium ) + gallium? ( x86? ( llvm ) amd64? ( llvm ) ) ) + video_cards_r100? ( classic ) + video_cards_r200? ( classic ) + video_cards_r300? ( gallium x86? ( llvm ) amd64? ( llvm ) ) + video_cards_r600? ( gallium ) + video_cards_radeonsi? ( gallium llvm ) + video_cards_vivante? ( gallium ) + video_cards_vmware? ( gallium ) + ${PYTHON_REQUIRED_USE} +" + +LIBDRM_DEPSTRING=">=x11-libs/libdrm-2.4.67" +# keep correct libdrm and dri2proto dep +# keep blocks in rdepend for binpkg +RDEPEND=" + !<x11-base/xorg-server-1.7 + !<=x11-proto/xf86driproto-2.0.3 + abi_x86_32? ( !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)] ) + classic? ( app-eselect/eselect-mesa ) + gallium? ( app-eselect/eselect-mesa ) + >=app-eselect/eselect-opengl-1.3.0 + udev? ( kernel_linux? ( >=virtual/libudev-215:=[${MULTILIB_USEDEP}] ) ) + >=dev-libs/expat-2.1.0-r3:=[${MULTILIB_USEDEP}] + >=x11-libs/libX11-1.6.2:=[${MULTILIB_USEDEP}] + >=x11-libs/libxshmfence-1.1:=[${MULTILIB_USEDEP}] + >=x11-libs/libXdamage-1.1.4-r1:=[${MULTILIB_USEDEP}] + >=x11-libs/libXext-1.3.2:=[${MULTILIB_USEDEP}] + >=x11-libs/libXxf86vm-1.1.3:=[${MULTILIB_USEDEP}] + >=x11-libs/libxcb-1.9.3:=[${MULTILIB_USEDEP}] + x11-libs/libXfixes:=[${MULTILIB_USEDEP}] + llvm? ( !kernel_FreeBSD? ( + video_cards_radeonsi? ( virtual/libelf:0=[${MULTILIB_USEDEP}] ) + !video_cards_r600? ( + video_cards_radeon? ( virtual/libelf:0=[${MULTILIB_USEDEP}] ) + ) ) + >=sys-devel/llvm-3.6.0:=[${MULTILIB_USEDEP}] + ) + opencl? ( + app-eselect/eselect-opencl + dev-libs/libclc + !kernel_FreeBSD? ( virtual/libelf:0=[${MULTILIB_USEDEP}] ) + ) + openmax? ( >=media-libs/libomxil-bellagio-0.9.3:=[${MULTILIB_USEDEP}] ) + vaapi? ( + >=x11-libs/libva-1.6.0:=[${MULTILIB_USEDEP}] + video_cards_nouveau? ( !<=x11-libs/libva-vdpau-driver-0.7.4-r3 ) + ) + vdpau? ( >=x11-libs/libvdpau-1.1:=[${MULTILIB_USEDEP}] ) + wayland? ( >=dev-libs/wayland-1.2.0:=[${MULTILIB_USEDEP}] ) + xvmc? ( >=x11-libs/libXvMC-1.0.8:=[${MULTILIB_USEDEP}] ) + ${LIBDRM_DEPSTRING}[video_cards_freedreno?,video_cards_nouveau?,video_cards_vc4?,video_cards_vivante?,video_cards_vmware?,${MULTILIB_USEDEP}] +" +for card in ${INTEL_CARDS}; do + RDEPEND="${RDEPEND} + video_cards_${card}? ( ${LIBDRM_DEPSTRING}[video_cards_intel] ) + " +done + +for card in ${RADEON_CARDS}; do + RDEPEND="${RDEPEND} + video_cards_${card}? ( ${LIBDRM_DEPSTRING}[video_cards_radeon] ) + " +done +RDEPEND="${RDEPEND} + video_cards_radeonsi? ( ${LIBDRM_DEPSTRING}[video_cards_amdgpu] ) +" + +# FIXME: kill the sys-devel/llvm[video_cards_radeon] compat once +# LLVM < 3.9 is out of the game +DEPEND="${RDEPEND} + llvm? ( + video_cards_radeonsi? ( || ( + sys-devel/llvm[llvm_targets_AMDGPU] + sys-devel/llvm[video_cards_radeon] + ) ) + ) + opencl? ( + >=sys-devel/llvm-3.4.2:=[${MULTILIB_USEDEP}] + >=sys-devel/clang-3.4.2:=[${MULTILIB_USEDEP}] + >=sys-devel/gcc-4.6 + ) + sys-devel/gettext + virtual/pkgconfig + valgrind? ( dev-util/valgrind ) + >=x11-proto/dri2proto-2.8-r1:=[${MULTILIB_USEDEP}] + dri3? ( + >=x11-proto/dri3proto-1.0:=[${MULTILIB_USEDEP}] + >=x11-proto/presentproto-1.0:=[${MULTILIB_USEDEP}] + ) + >=x11-proto/glproto-1.4.17-r1:=[${MULTILIB_USEDEP}] + >=x11-proto/xextproto-7.2.1-r1:=[${MULTILIB_USEDEP}] + >=x11-proto/xf86driproto-2.1.1-r1:=[${MULTILIB_USEDEP}] + >=x11-proto/xf86vidmodeproto-2.3.1-r1:=[${MULTILIB_USEDEP}] +" +[[ ${PV} == 9999 ]] && DEPEND+=" + sys-devel/bison + sys-devel/flex + ${PYTHON_DEPS} + $(python_gen_any_dep ">=dev-python/mako-0.7.3[\${PYTHON_USEDEP}]") +" + +S="${WORKDIR}/${MY_P}" +EGIT_CHECKOUT_DIR=${S} + +QA_WX_LOAD=" +x86? ( + !pic? ( + usr/lib*/libglapi.so.0.0.0 + usr/lib*/libGLESv1_CM.so.1.1.0 + usr/lib*/libGLESv2.so.2.0.0 + usr/lib*/libGL.so.1.2.0 + usr/lib*/libOSMesa.so.8.0.0 + ) +)" + +pkg_setup() { + # warning message for bug 459306 + if use llvm && has_version sys-devel/llvm[!debug=]; then + ewarn "Mismatch between debug USE flags in media-libs/mesa and sys-devel/llvm" + ewarn "detected! This can cause problems. For details, see bug 459306." + fi + + python-any-r1_pkg_setup +} + +src_prepare() { + if [[ ${PV} == 9999 ]]; then + eautoreconf + else + epatch "${FILESDIR}"/07_gallium-fix-build-failure-on-powerpcspe.diff \ + "${FILESDIR}"/egl-platform-mir.patch \ + "${FILESDIR}"/i915-dont-default-to-2.1.patch + fi +} + +multilib_src_configure() { + local myconf + + if use classic; then + # Configurable DRI drivers + driver_enable swrast + + # Intel code + driver_enable video_cards_i915 i915 + driver_enable video_cards_i965 i965 + if ! use video_cards_i915 && \ + ! use video_cards_i965; then + driver_enable video_cards_intel i915 i965 + fi + + # Nouveau code + driver_enable video_cards_nouveau nouveau + + # ATI code + driver_enable video_cards_r100 radeon + driver_enable video_cards_r200 r200 + if ! use video_cards_r100 && \ + ! use video_cards_r200; then + driver_enable video_cards_radeon radeon r200 + fi + fi + + if use egl; then + myconf+=" --with-egl-platforms=x11$(use wayland && echo ",wayland")$(use gbm && echo ",drm")" + fi + + if use gallium; then + myconf+=" + $(use_enable d3d9 nine) + $(use_enable llvm gallium-llvm) + $(use_enable openmax omx) + $(use_enable vaapi va) + $(use_enable vdpau) + $(use_enable xa) + $(use_enable xvmc) + " + use vaapi && myconf+=" --with-va-libdir=/usr/$(get_libdir)/va/drivers" + + gallium_enable swrast + gallium_enable video_cards_vc4 vc4 + gallium_enable video_cards_vmware svga + gallium_enable video_cards_nouveau nouveau + gallium_enable video_cards_i915 i915 + gallium_enable video_cards_ilo ilo + gallium_enable video_cards_imx imx + if ! use video_cards_i915 && \ + ! use video_cards_i965; then + gallium_enable video_cards_intel i915 + fi + + gallium_enable video_cards_r300 r300 + gallium_enable video_cards_r600 r600 + gallium_enable video_cards_radeonsi radeonsi + if ! use video_cards_r300 && \ + ! use video_cards_r600; then + gallium_enable video_cards_radeon r300 r600 + fi + + gallium_enable video_cards_freedreno freedreno + gallium_enable video_cards_vivante etnaviv + # opencl stuff + if use opencl; then + myconf+=" + $(use_enable opencl) + --with-clang-libdir="${EPREFIX}/usr/lib" + " + fi + fi + + # x86 hardened pax_kernel needs glx-rts, bug 240956 + if [[ ${ABI} == x86 ]]; then + myconf+=" $(use_enable pax_kernel glx-read-only-text)" + fi + + # on abi_x86_32 hardened we need to have asm disable + if [[ ${ABI} == x86* ]] && use pic; then + myconf+=" --disable-asm" + fi + + if use gallium; then + myconf+=" $(use_enable osmesa gallium-osmesa)" + else + myconf+=" $(use_enable osmesa)" + fi + + # build fails with BSD indent, bug #428112 + use userland_GNU || export INDENT=cat + + ECONF_SOURCE="${S}" \ + econf \ + --enable-dri \ + --enable-glx \ + --enable-shared-glapi \ + --disable-shader-cache \ + $(use_enable !bindist texture-float) \ + $(use_enable d3d9 nine) \ + $(use_enable debug) \ + $(use_enable dri3) \ + $(use_enable egl) \ + $(use_enable gbm) \ + $(use_enable gles1) \ + $(use_enable gles2) \ + $(use_enable nptl glx-tls) \ + $(use_enable !udev sysfs) \ + --enable-valgrind=$(usex valgrind auto no) \ + --enable-llvm-shared-libs \ + --with-dri-drivers=${DRI_DRIVERS} \ + --with-gallium-drivers=${GALLIUM_DRIVERS} \ + PYTHON2="${PYTHON}" \ + ${myconf} +} + +multilib_src_install() { + emake install DESTDIR="${D}" + + if use classic || use gallium; then + ebegin "Moving DRI/Gallium drivers for dynamic switching" + local gallium_drivers=( i915_dri.so i965_dri.so r300_dri.so r600_dri.so swrast_dri.so ) + keepdir /usr/$(get_libdir)/dri + dodir /usr/$(get_libdir)/mesa + for x in ${gallium_drivers[@]}; do + if [ -f "$(get_libdir)/gallium/${x}" ]; then + mv -f "${ED}/usr/$(get_libdir)/dri/${x}" "${ED}/usr/$(get_libdir)/dri/${x/_dri.so/g_dri.so}" \ + || die "Failed to move ${x}" + fi + done + if use classic; then + emake -C "${BUILD_DIR}/src/mesa/drivers/dri" DESTDIR="${D}" install + fi + for x in "${ED}"/usr/$(get_libdir)/dri/*.so; do + if [ -f ${x} -o -L ${x} ]; then + mv -f "${x}" "${x/dri/mesa}" \ + || die "Failed to move ${x}" + fi + done + pushd "${ED}"/usr/$(get_libdir)/dri || die "pushd failed" + ln -s ../mesa/*.so . || die "Creating symlink failed" + # remove symlinks to drivers known to eselect + for x in ${gallium_drivers[@]}; do + if [ -f ${x} -o -L ${x} ]; then + rm "${x}" || die "Failed to remove ${x}" + fi + done + popd + eend $? + fi + if use opencl; then + ebegin "Moving Gallium/Clover OpenCL implementation for dynamic switching" + local cl_dir="/usr/$(get_libdir)/OpenCL/vendors/mesa" + dodir ${cl_dir}/{lib,include} + if [ -f "${ED}/usr/$(get_libdir)/libOpenCL.so" ]; then + mv -f "${ED}"/usr/$(get_libdir)/libOpenCL.so* \ + "${ED}"${cl_dir} + fi + if [ -f "${ED}/usr/include/CL/opencl.h" ]; then + mv -f "${ED}"/usr/include/CL \ + "${ED}"${cl_dir}/include + fi + eend $? + fi + + if use openmax; then + echo "XDG_DATA_DIRS=\"${EPREFIX}/usr/share/mesa/xdg\"" > "${T}/99mesaxdgomx" + doenvd "${T}"/99mesaxdgomx + keepdir /usr/share/mesa/xdg + fi +} + +multilib_src_install_all() { + prune_libtool_files --all + einstalldocs + + if use !bindist; then + dodoc docs/patents.txt + fi + + # Install config file for eselect mesa + insinto /usr/share/mesa + newins "${FILESDIR}/eselect-mesa.conf.9.2" eselect-mesa.conf +} + +multilib_src_test() { + if use llvm; then + local llvm_tests='lp_test_arit lp_test_arit lp_test_blend lp_test_blend lp_test_conv lp_test_conv lp_test_format lp_test_format lp_test_printf lp_test_printf' + pushd src/gallium/drivers/llvmpipe >/dev/null || die + emake ${llvm_tests} + pax-mark m ${llvm_tests} + popd >/dev/null || die + fi + emake check +} + +pkg_postinst() { + # Switch to the xorg implementation. + echo + eselect opengl set --use-old ${OPENGL_DIR} + + # Select classic/gallium drivers + if use classic || use gallium; then + eselect mesa set --auto + fi + + # Switch to mesa opencl + if use opencl; then + eselect opencl set --use-old ${PN} + fi + + # run omxregister-bellagio to make the OpenMAX drivers known system-wide + if use openmax; then + ebegin "Registering OpenMAX drivers" + BELLAGIO_SEARCH_PATH="${EPREFIX}/usr/$(get_libdir)/libomxil-bellagio0" \ + OMX_BELLAGIO_REGISTRY=${EPREFIX}/usr/share/mesa/xdg/.omxregister \ + omxregister-bellagio + eend $? + fi + + # warn about patent encumbered texture-float + if use !bindist; then + elog "USE=\"bindist\" was not set. Potentially patent encumbered code was" + elog "enabled. Please see patents.txt for an explanation." + fi + + if ! has_version media-libs/libtxc_dxtn; then + elog "Note that in order to have full S3TC support, it is necessary to install" + elog "media-libs/libtxc_dxtn as well. This may be necessary to get nice" + elog "textures in some apps, and some others even require this to run." + fi +} + +pkg_prerm() { + if use openmax; then + rm "${EPREFIX}"/usr/share/mesa/xdg/.omxregister + fi +} + +# $1 - VIDEO_CARDS flag +# other args - names of DRI drivers to enable +# TODO: avoid code duplication for a more elegant implementation +driver_enable() { + case $# in + # for enabling unconditionally + 1) + DRI_DRIVERS+=",$1" + ;; + *) + if use $1; then + shift + for i in $@; do + DRI_DRIVERS+=",${i}" + done + fi + ;; + esac +} + +gallium_enable() { + case $# in + # for enabling unconditionally + 1) + GALLIUM_DRIVERS+=",$1" + ;; + *) + if use $1; then + shift + for i in $@; do + GALLIUM_DRIVERS+=",${i}" + done + fi + ;; + esac +} diff --git a/media-libs/mesa/mesa-9999.ebuild b/media-libs/mesa/mesa-9999.ebuild index 199968f..0cc8fa2 100644 --- a/media-libs/mesa/mesa-9999.ebuild +++ b/media-libs/mesa/mesa-9999.ebuild @@ -1,50 +1,50 @@ -# Copyright 1999-2015 Gentoo Foundation +# Copyright 1999-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: $ +# $Id$ -EAPI=5 +EAPI=6 -EGIT_REPO_URI="git://anongit.freedesktop.org/mesa/mesa" +EGIT_REPO_URI="https://anongit.freedesktop.org/git/mesa/mesa.git" -if [[ ${PV} = 9999* ]]; then +if [[ ${PV} = 9999 ]]; then GIT_ECLASS="git-r3" EXPERIMENTAL="true" fi PYTHON_COMPAT=( python2_7 ) -inherit autotools flag-o-matic multilib-minimal python-any-r1 pax-utils ${GIT_ECLASS} +inherit autotools multilib-minimal python-any-r1 pax-utils ${GIT_ECLASS} OPENGL_DIR="xorg-x11" MY_P="${P/_/-}" -FOLDER="${PV/_rc*/}" DESCRIPTION="OpenGL-like graphic library for Linux" HOMEPAGE="http://mesa3d.sourceforge.net/" -if [[ $PV == 9999* ]]; then +if [[ $PV == 9999 ]]; then SRC_URI="" + KEYWORDS="" else - SRC_URI="ftp://ftp.freedesktop.org/pub/mesa/${FOLDER}/${MY_P}.tar.xz" + SRC_URI="https://mesa.freedesktop.org/archive/${MY_P}.tar.xz" + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~sparc-solaris ~x64-solaris ~x86-solaris" fi LICENSE="MIT" SLOT="0" -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~arm-linux ~ia64-linux ~x86-linux ~sparc-solaris ~x64-solaris ~x86-solaris" RESTRICT="!bindist? ( bindist )" INTEL_CARDS="i915 i965 ilo intel" RADEON_CARDS="r100 r200 r300 r600 radeon radeonsi" -VIDEO_CARDS="${INTEL_CARDS} ${RADEON_CARDS} freedreno nouveau tegra vmware vc4" +VIDEO_CARDS="${INTEL_CARDS} ${RADEON_CARDS} freedreno imx nouveau tegra vc4 vivante vmware" for card in ${VIDEO_CARDS}; do IUSE_VIDEO_CARDS+=" video_cards_${card}" done IUSE="${IUSE_VIDEO_CARDS} bindist +classic d3d9 debug +dri3 +egl +gallium +gbm gles1 gles2 +llvm - +nptl opencl osmesa pax_kernel openmax pic selinux +udev vaapi vdpau - wayland xvmc xa kernel_FreeBSD" + +nptl opencl osmesa pax_kernel openmax pic selinux vaapi valgrind vdpau + vulkan wayland xvmc xa" REQUIRED_USE=" d3d9? ( dri3 gallium ) @@ -55,27 +55,31 @@ REQUIRED_USE=" gles2? ( egl ) vaapi? ( gallium ) vdpau? ( gallium ) + vulkan? ( || ( video_cards_i965 video_cards_radeonsi ) + video_cards_radeonsi? ( llvm ) ) wayland? ( egl gbm ) xa? ( gallium ) video_cards_freedreno? ( gallium ) - video_cards_tegra? ( classic ) - video_cards_vc4? ( gallium ) video_cards_intel? ( classic ) video_cards_i915? ( || ( classic gallium ) ) video_cards_i965? ( classic ) video_cards_ilo? ( gallium ) + video_cards_imx? ( gallium ) video_cards_nouveau? ( || ( classic gallium ) ) - video_cards_radeon? ( || ( classic gallium ) ) + video_cards_radeon? ( || ( classic gallium ) + gallium? ( x86? ( llvm ) amd64? ( llvm ) ) ) video_cards_r100? ( classic ) video_cards_r200? ( classic ) - video_cards_r300? ( gallium llvm ) + video_cards_r300? ( gallium x86? ( llvm ) amd64? ( llvm ) ) video_cards_r600? ( gallium ) video_cards_radeonsi? ( gallium llvm ) + video_cards_tegra? ( gallium gbm ) + video_cards_vivante? ( gallium gbm ) video_cards_vmware? ( gallium ) ${PYTHON_REQUIRED_USE} " -LIBDRM_DEPSTRING=">=x11-libs/libdrm-2.4.57" +LIBDRM_DEPSTRING=">=x11-libs/libdrm-2.4.75" # keep correct libdrm and dri2proto dep # keep blocks in rdepend for binpkg RDEPEND=" @@ -85,10 +89,7 @@ RDEPEND=" classic? ( app-eselect/eselect-mesa ) gallium? ( app-eselect/eselect-mesa ) >=app-eselect/eselect-opengl-1.3.0 - udev? ( kernel_linux? ( >=virtual/libudev-215:=[${MULTILIB_USEDEP}] ) ) >=dev-libs/expat-2.1.0-r3:=[${MULTILIB_USEDEP}] - gbm? ( >=virtual/libudev-215:=[${MULTILIB_USEDEP}] ) - dri3? ( >=virtual/libudev-215:=[${MULTILIB_USEDEP}] ) >=x11-libs/libX11-1.6.2:=[${MULTILIB_USEDEP}] >=x11-libs/libxshmfence-1.1:=[${MULTILIB_USEDEP}] >=x11-libs/libXdamage-1.1.4-r1:=[${MULTILIB_USEDEP}] @@ -97,32 +98,26 @@ RDEPEND=" >=x11-libs/libxcb-1.9.3:=[${MULTILIB_USEDEP}] x11-libs/libXfixes:=[${MULTILIB_USEDEP}] llvm? ( - video_cards_radeonsi? ( || ( - >=dev-libs/elfutils-0.155-r1:=[${MULTILIB_USEDEP}] - >=dev-libs/libelf-0.8.13-r2:=[${MULTILIB_USEDEP}] - ) ) - !video_cards_r600? ( - video_cards_radeon? ( || ( - >=dev-libs/elfutils-0.155-r1:=[${MULTILIB_USEDEP}] - >=dev-libs/libelf-0.8.13-r2:=[${MULTILIB_USEDEP}] - ) ) + video_cards_radeonsi? ( + virtual/libelf:0=[${MULTILIB_USEDEP}] + vulkan? ( >=sys-devel/llvm-3.9.0:=[${MULTILIB_USEDEP}] ) ) - >=sys-devel/llvm-3.4.2:=[${MULTILIB_USEDEP}] + >=sys-devel/llvm-3.6.0:=[${MULTILIB_USEDEP}] ) opencl? ( app-eselect/eselect-opencl dev-libs/libclc - || ( - >=dev-libs/elfutils-0.155-r1:=[${MULTILIB_USEDEP}] - >=dev-libs/libelf-0.8.13-r2:=[${MULTILIB_USEDEP}] - ) + virtual/libelf:0=[${MULTILIB_USEDEP}] ) openmax? ( >=media-libs/libomxil-bellagio-0.9.3:=[${MULTILIB_USEDEP}] ) - vaapi? ( >=x11-libs/libva-0.35.0:=[${MULTILIB_USEDEP}] ) - vdpau? ( >=x11-libs/libvdpau-0.7:=[${MULTILIB_USEDEP}] ) + vaapi? ( + >=x11-libs/libva-1.6.0:=[${MULTILIB_USEDEP}] + video_cards_nouveau? ( !<=x11-libs/libva-vdpau-driver-0.7.4-r3 ) + ) + vdpau? ( >=x11-libs/libvdpau-1.1:=[${MULTILIB_USEDEP}] ) wayland? ( >=dev-libs/wayland-1.2.0:=[${MULTILIB_USEDEP}] ) xvmc? ( >=x11-libs/libXvMC-1.0.8:=[${MULTILIB_USEDEP}] ) - ${LIBDRM_DEPSTRING}[video_cards_freedreno?,video_cards_nouveau?,video_cards_tegra?,video_cards_vmware?,${MULTILIB_USEDEP}] + ${LIBDRM_DEPSTRING}[video_cards_freedreno?,video_cards_nouveau?,video_cards_vc4?,video_cards_vivante?,video_cards_vmware?,${MULTILIB_USEDEP}] " for card in ${INTEL_CARDS}; do RDEPEND="${RDEPEND} @@ -135,10 +130,18 @@ for card in ${RADEON_CARDS}; do video_cards_${card}? ( ${LIBDRM_DEPSTRING}[video_cards_radeon] ) " done +RDEPEND="${RDEPEND} + video_cards_radeonsi? ( ${LIBDRM_DEPSTRING}[video_cards_amdgpu] ) +" +# FIXME: kill the sys-devel/llvm[video_cards_radeon] compat once +# LLVM < 3.9 is out of the game DEPEND="${RDEPEND} llvm? ( - video_cards_radeonsi? ( sys-devel/llvm[video_cards_radeon] ) + video_cards_radeonsi? ( || ( + sys-devel/llvm[llvm_targets_AMDGPU] + sys-devel/llvm[video_cards_radeon] + ) ) ) opencl? ( >=sys-devel/llvm-3.4.2:=[${MULTILIB_USEDEP}] @@ -147,6 +150,7 @@ DEPEND="${RDEPEND} ) sys-devel/gettext virtual/pkgconfig + valgrind? ( dev-util/valgrind ) >=x11-proto/dri2proto-2.8-r1:=[${MULTILIB_USEDEP}] dri3? ( >=x11-proto/dri3proto-1.0:=[${MULTILIB_USEDEP}] @@ -157,7 +161,7 @@ DEPEND="${RDEPEND} >=x11-proto/xf86driproto-2.1.1-r1:=[${MULTILIB_USEDEP}] >=x11-proto/xf86vidmodeproto-2.3.1-r1:=[${MULTILIB_USEDEP}] " -[[ ${PV} == "9999" ]] && DEPEND+=" +[[ ${PV} == 9999 ]] && DEPEND+=" sys-devel/bison sys-devel/flex ${PYTHON_DEPS} @@ -167,10 +171,16 @@ DEPEND="${RDEPEND} S="${WORKDIR}/${MY_P}" EGIT_CHECKOUT_DIR=${S} -# It is slow without texrels, if someone wants slow -# mesa without texrels +pic use is worth the shot -QA_EXECSTACK="usr/lib*/libGL.so*" -QA_WX_LOAD="usr/lib*/libGL.so*" +QA_WX_LOAD=" +x86? ( + !pic? ( + usr/lib*/libglapi.so.0.0.0 + usr/lib*/libGLESv1_CM.so.1.1.0 + usr/lib*/libGLESv2.so.2.0.0 + usr/lib*/libGL.so.1.2.0 + usr/lib*/libOSMesa.so.8.0.0 + ) +)" pkg_setup() { # warning message for bug 459306 @@ -183,18 +193,11 @@ pkg_setup() { } src_prepare() { - # fix for hardened pax_kernel, bug 240956 - [[ ${PV} != 9999* ]] && epatch "${FILESDIR}"/glx_ro_text_segm.patch - - epatch "${FILESDIR}"/${PN}-10.2.4-optional-gl-headers.patch - - eautoreconf + [[ ${PV} == 9999 ]] && eautoreconf + eapply_user } multilib_src_configure() { - # new drm include confusion (who provides, libdrm or linux-headers? - append-cflags -I/usr/include/drm - local myconf if use classic; then @@ -219,11 +222,10 @@ multilib_src_configure() { ! use video_cards_r200; then driver_enable video_cards_radeon radeon r200 fi - fi if use egl; then - myconf+="--with-egl-platforms=x11$(use wayland && echo ",wayland")$(use gbm && echo ",drm") " + myconf+=" --with-egl-platforms=x11$(use wayland && echo ",wayland")$(use gbm && echo ",drm")" fi if use gallium; then @@ -236,11 +238,16 @@ multilib_src_configure() { $(use_enable xa) $(use_enable xvmc) " + use vaapi && myconf+=" --with-va-libdir=/usr/$(get_libdir)/va/drivers" + gallium_enable swrast + gallium_enable video_cards_vc4 vc4 + gallium_enable video_cards_vivante etnaviv gallium_enable video_cards_vmware svga gallium_enable video_cards_nouveau nouveau gallium_enable video_cards_i915 i915 gallium_enable video_cards_ilo ilo + gallium_enable video_cards_imx imx if ! use video_cards_i915 && \ ! use video_cards_i965; then gallium_enable video_cards_intel i915 @@ -253,16 +260,8 @@ multilib_src_configure() { ! use video_cards_r600; then gallium_enable video_cards_radeon r300 r600 fi - + gallium_enable video_cards_tegra tegra gallium_enable video_cards_freedreno freedreno - - # (still) experimental tegra patches - # WTF?? pinged tagr via gmail about status - #gallium_enable video_cards_tegra tegra - - # experimental RPi VideoCore4 driver (needs RPi drm kernel patches) - gallium_enable video_cards_vc4 vc4 - # opencl stuff if use opencl; then myconf+=" @@ -272,11 +271,14 @@ multilib_src_configure() { fi fi + if use vulkan; then + vulkan_enable video_cards_i965 intel + vulkan_enable video_cards_radeonsi radeon + fi + # x86 hardened pax_kernel needs glx-rts, bug 240956 - if use pax_kernel; then - myconf+=" - $(use_enable x86 glx-rts) - " + if [[ ${ABI} == x86 ]]; then + myconf+=" $(use_enable pax_kernel glx-read-only-text)" fi # on abi_x86_32 hardened we need to have asm disable @@ -284,6 +286,12 @@ multilib_src_configure() { myconf+=" --disable-asm" fi + if use gallium; then + myconf+=" $(use_enable osmesa gallium-osmesa)" + else + myconf+=" $(use_enable osmesa)" + fi + # build fails with BSD indent, bug #428112 use userland_GNU || export INDENT=cat @@ -292,6 +300,7 @@ multilib_src_configure() { --enable-dri \ --enable-glx \ --enable-shared-glapi \ + --disable-shader-cache \ $(use_enable !bindist texture-float) \ $(use_enable d3d9 nine) \ $(use_enable debug) \ @@ -301,11 +310,11 @@ multilib_src_configure() { $(use_enable gles1) \ $(use_enable gles2) \ $(use_enable nptl glx-tls) \ - $(use_enable osmesa) \ - $(use_enable !udev sysfs) \ + --enable-valgrind=$(usex valgrind auto no) \ --enable-llvm-shared-libs \ --with-dri-drivers=${DRI_DRIVERS} \ --with-gallium-drivers=${GALLIUM_DRIVERS} \ + --with-vulkan-drivers=${VULKAN_DRIVERS} \ PYTHON2="${PYTHON}" \ ${myconf} } @@ -469,3 +478,20 @@ gallium_enable() { ;; esac } + +vulkan_enable() { + case $# in + # for enabling unconditionally + 1) + VULKAN_DRIVERS+=",$1" + ;; + *) + if use $1; then + shift + for i in $@; do + VULKAN_DRIVERS+=",${i}" + done + fi + ;; + esac +} |