Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- commit 84246bcebf415b524c28ded3027b23b6a6706221
- Author: Christopher James Halse Rogers <raof@ubuntu.com>
- Date: Thu Feb 7 16:34:17 2013 +0800
- Squash all the bzr commits for Mir into one ungovernable mess, because we no longer invest in our tooling
- diff --git a/configure.ac b/configure.ac
- index ef6da49..1718548 100644
- --- a/configure.ac
- +++ b/configure.ac
- @@ -1542,7 +1542,9 @@ for plat in $egl_platforms; do
- android|gdi)
- ;;
- -
- + mir)
- + PKG_CHECK_MODULES([MIR], [mirclient])
- + ;;
- *)
- AC_MSG_ERROR([EGL platform '$plat' does not exist])
- ;;
- @@ -1570,6 +1572,7 @@ AM_CONDITIONAL(HAVE_EGL_PLATFORM_WAYLAND, echo "$egl_platforms" | grep 'wayland'
- AM_CONDITIONAL(HAVE_EGL_PLATFORM_DRM, echo "$egl_platforms" | grep 'drm' >/dev/null 2>&1)
- AM_CONDITIONAL(HAVE_EGL_PLATFORM_FBDEV, echo "$egl_platforms" | grep 'fbdev' >/dev/null 2>&1)
- AM_CONDITIONAL(HAVE_EGL_PLATFORM_NULL, echo "$egl_platforms" | grep 'null' >/dev/null 2>&1)
- +AM_CONDITIONAL(HAVE_EGL_PLATFORM_MIR, echo "$egl_platforms" | grep 'mir' >/dev/null 2>&1)
- AM_CONDITIONAL(HAVE_EGL_DRIVER_DRI2, test "x$HAVE_EGL_DRIVER_DRI2" != "x")
- AM_CONDITIONAL(HAVE_EGL_DRIVER_GLX, test "x$HAVE_EGL_DRIVER_GLX" != "x")
- diff --git a/src/egl/drivers/dri2/Makefile.am b/src/egl/drivers/dri2/Makefile.am
- index 45f7dfa..dfb0c05 100644
- --- a/src/egl/drivers/dri2/Makefile.am
- +++ b/src/egl/drivers/dri2/Makefile.am
- @@ -62,3 +62,9 @@ if HAVE_EGL_PLATFORM_DRM
- libegl_dri2_la_SOURCES += platform_drm.c
- AM_CFLAGS += -DHAVE_DRM_PLATFORM
- endif
- +
- +if HAVE_EGL_PLATFORM_MIR
- +libegl_dri2_la_SOURCES += platform_mir.c
- +AM_CFLAGS += -DHAVE_MIR_PLATFORM
- +AM_CFLAGS += $(MIR_CFLAGS)
- +endif
- diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
- index 351fbf4..99d8508 100644
- --- a/src/egl/drivers/dri2/egl_dri2.c
- +++ b/src/egl/drivers/dri2/egl_dri2.c
- @@ -587,6 +587,12 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp)
- return EGL_TRUE;
- return dri2_initialize_wayland(drv, disp);
- #endif
- +#ifdef HAVE_MIR_PLATFORM
- + case _EGL_PLATFORM_MIR:
- + if (disp->Options.TestOnly)
- + return EGL_TRUE;
- + return dri2_initialize_mir(drv, disp);
- +#endif
- #endif
- #ifdef HAVE_ANDROID_PLATFORM
- case _EGL_PLATFORM_ANDROID:
- diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
- index 84ea2a6..d82b9f8 100644
- --- a/src/egl/drivers/dri2/egl_dri2.h
- +++ b/src/egl/drivers/dri2/egl_dri2.h
- @@ -65,6 +65,10 @@
- #endif /* HAVE_ANDROID_PLATFORM */
- +#ifdef HAVE_MIR_PLATFORM
- +#include <mir_client_library.h>
- +#endif
- +
- #include "eglconfig.h"
- #include "eglcontext.h"
- #include "egldisplay.h"
- @@ -134,6 +138,10 @@ struct dri2_egl_display
- int formats;
- #endif
- +#ifdef HAVE_MIR_PLATFORM
- + MirConnection *mir_conn;
- +#endif
- +
- int (*authenticate) (_EGLDisplay *disp, uint32_t id);
- };
- @@ -182,7 +190,9 @@ 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
- @@ -204,6 +214,10 @@ struct dri2_egl_surface
- /* EGL-owned buffers */
- __DRIbuffer *local_buffers[__DRI_BUFFER_COUNT];
- #endif
- +
- +#ifdef HAVE_MIR_PLATFORM
- + MirSurface *mir_surf;
- +#endif
- };
- @@ -265,6 +279,9 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp);
- EGLBoolean
- dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *disp);
- +EGLBoolean
- +dri2_initialize_mir(_EGLDriver *drv, _EGLDisplay *disp);
- +
- char *
- dri2_get_driver_for_fd(int fd);
- char *
- diff --git a/src/egl/drivers/dri2/platform_mir.c b/src/egl/drivers/dri2/platform_mir.c
- new file mode 100644
- index 0000000..5782875
- --- /dev/null
- +++ b/src/egl/drivers/dri2/platform_mir.c
- @@ -0,0 +1,376 @@
- +/*
- + * 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>
- + */
- +
- +#include <mir_client_library.h>
- +
- +#include "egl_dri2.h"
- +
- +#include <stdlib.h>
- +#include <string.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 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 void
- +mir_copy_back_to_front(struct dri2_egl_surface *surf)
- +{
- + memcpy(surf->dri_buffers[__DRI_BUFFER_FRONT_LEFT],
- + surf->dri_buffers[__DRI_BUFFER_BACK_LEFT],
- + sizeof(*surf->dri_buffers[__DRI_BUFFER_BACK_LEFT]));
- +
- + surf->dri_buffers[__DRI_BUFFER_FRONT_LEFT]->attachment =
- + __DRI_BUFFER_FRONT_LEFT;
- +}
- +
- +static void
- +mir_populate_colour_buffers(struct dri2_egl_surface *surf)
- +{
- + MirBufferPackage buffer_package;
- +
- + mir_surface_get_current_buffer(surf->mir_surf, &buffer_package);
- + /* We expect [name, pitch] in our buffer */
- + assert(buffer_package.data_items == 1);
- +
- + /* Frontbuffer hack; Mir doesn't give us access to the front buffer */
- + mir_copy_back_to_front(surf);
- +
- + surf->dri_buffers[__DRI_BUFFER_BACK_LEFT]->name = buffer_package.data[0];
- + /* Man, I hope that Intel's just being funky when they multiply pitch by
- + cpp */
- + surf->dri_buffers[__DRI_BUFFER_BACK_LEFT]->pitch = buffer_package.stride;
- +}
- +
- +/**
- + * 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;
- + 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 = (MirSurface *)window;
- + mir_surface_get_parameters(dri2_surf->mir_surf, &surf_params);
- + 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;
- +
- + mir_populate_colour_buffers(dri2_surf);
- + /* Hack: this is not actually the front buffer, but we can't get it */
- + mir_copy_back_to_front(dri2_surf);
- +
- + dri2_surf->dri_drawable =
- + (*dri2_dpy->dri2->createNewDrawable) (dri2_dpy->dri_screen,
- + dri2_conf->dri_double_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 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;
- +
- + (*dri2_dpy->core->destroyDrawable)(dri2_surf->dri_drawable);
- +
- + for (i = 0; i < __DRI_BUFFER_COUNT; ++i) {
- + if (dri2_surf->dri_buffers[i] && !((i == __DRI_BUFFER_FRONT_LEFT) ||
- + (i == __DRI_BUFFER_BACK_LEFT))) {
- + dri2_dpy->dri2->releaseBuffer(dri2_dpy->dri_screen,
- + dri2_surf->dri_buffers[i]);
- + }
- + }
- +
- + free(surf);
- +
- + return EGL_TRUE;
- +}
- +
- +static void
- +surface_callback(MirSurface *surface, void *ctx)
- +{
- + struct dri2_egl_surface *dri2_surf = dri2_egl_surface(ctx);
- +
- +}
- +
- +/**
- + * 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);
- + struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv);
- +
- + mir_wait_for(mir_surface_next_buffer(dri2_surf->mir_surf, surface_callback, dri2_surf));
- +
- + mir_populate_colour_buffers(dri2_surf);
- +
- + (*dri2_dpy->flush->flush)(dri2_surf->dri_drawable);
- + (*dri2_dpy->flush->invalidate)(dri2_surf->dri_drawable);
- +
- + return EGL_TRUE;
- +}
- +
- +static void connection_callback(MirConnection *conn, void *context)
- +{
- + struct dri2_egl_display *dri2_dpy = context;
- +
- + dri2_dpy->mir_conn = conn;
- +}
- +
- +static int
- +dri2_mir_authenticate(_EGLDisplay *disp, uint32_t id)
- +{
- + return 0;
- +}
- +
- +EGLBoolean
- +dri2_initialize_mir(_EGLDriver *drv, _EGLDisplay *disp)
- +{
- + struct dri2_egl_display *dri2_dpy;
- + MirPlatformPackage platform;
- + const __DRIconfig *config;
- + static const unsigned int argb_masks[4] =
- + { 0xff0000, 0xff00, 0xff, 0xff000000 };
- + uint32_t types;
- + int i;
- +
- + drv->API.CreateWindowSurface = dri2_create_mir_window_surface;
- + drv->API.DestroySurface = dri2_destroy_mir_surface;
- + drv->API.SwapBuffers = dri2_swap_buffers;
- +/* drv->API.CreatePixmapSurface = dri2_create_pixmap_surface;
- + drv->API.CreatePbufferSurface = dri2_create_pbuffer_surface;
- + drv->API.CopyBuffers = dri2_copy_buffers;
- + drv->API.CreateImageKHR = dri2_x11_create_image_khr;
- + drv->API.SwapInterval = dri2_swap_interval;
- +*/
- +
- + dri2_dpy = calloc(1, sizeof *dri2_dpy);
- + if (!dri2_dpy)
- + return _eglError(EGL_BAD_ALLOC, "eglInitialize");
- +
- + disp->DriverData = (void *) dri2_dpy;
- + if (disp->PlatformDisplay == NULL) {
- + mir_wait_for(mir_connect("some_socket_file", "EGL Client",
- + connection_callback, dri2_dpy));
- + } else {
- + dri2_dpy->mir_conn = (MirConnection *)disp->PlatformDisplay;
- + }
- +
- + if (!mir_connection_is_valid(dri2_dpy->mir_conn)) {
- + _eglLog(_EGL_WARNING, "DRI2: mir_connect failed: %s",
- + mir_connection_get_error_message(dri2_dpy->mir_conn));
- + goto cleanup_dpy;
- + }
- +
- + mir_connection_get_platform(dri2_dpy->mir_conn, &platform);
- + dri2_dpy->fd = platform.fd[0];
- + dri2_dpy->driver_name = dri2_get_driver_for_fd(dri2_dpy->fd);
- + dri2_dpy->device_name = dri2_get_device_name_for_fd(dri2_dpy->fd);
- +
- + if (dri2_dpy->driver_name == NULL ||
- + dri2_dpy->device_name == NULL)
- + goto cleanup_conn;
- +
- + if (!dri2_load_driver(disp))
- + goto cleanup_conn;
- +
- + dri2_dpy->dri2_loader_extension.base.name = __DRI_DRI2_LOADER;
- + dri2_dpy->dri2_loader_extension.base.version = 3;
- + dri2_dpy->dri2_loader_extension.getBuffers = dri2_get_buffers;
- + dri2_dpy->dri2_loader_extension.flushFrontBuffer = dri2_flush_front_buffer;
- + dri2_dpy->dri2_loader_extension.getBuffersWithFormat =
- + dri2_get_buffers_with_format;
- +
- + dri2_dpy->extensions[0] = &dri2_dpy->dri2_loader_extension.base;
- + dri2_dpy->extensions[1] = &image_lookup_extension.base;
- + dri2_dpy->extensions[2] = &use_invalidate.base;
- + dri2_dpy->extensions[3] = NULL;
- +
- + if (!dri2_create_screen(disp))
- + goto cleanup_conn;
- +
- + 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, 0, types, NULL, argb_masks);
- + }
- +
- + dri2_dpy->authenticate = dri2_mir_authenticate;
- +
- + disp->VersionMajor = 1;
- + disp->VersionMinor = 4;
- +
- + return EGL_TRUE;
- +
- + cleanup_conn:
- + if (disp->PlatformDisplay == NULL)
- + mir_connection_release(dri2_dpy->mir_conn);
- + cleanup_dpy:
- + free(dri2_dpy);
- +
- + return EGL_FALSE;
- +}
- diff --git a/src/egl/main/Makefile.am b/src/egl/main/Makefile.am
- index ca5257a..64af1fd 100644
- --- a/src/egl/main/Makefile.am
- +++ b/src/egl/main/Makefile.am
- @@ -103,6 +103,12 @@ if HAVE_EGL_PLATFORM_NULL
- AM_CFLAGS += -DHAVE_NULL_PLATFORM
- endif
- +if HAVE_EGL_PLATFORM_MIR
- +AM_CFLAGS += -DHAVE_MIR_PLATFORM
- +AM_CFLAGS += $(MIR_CFLAGS)
- +libEGL_la_LIBADD += $(MIR_LIBS)
- +endif
- +
- if HAVE_EGL_DRIVER_GLX
- AM_CFLAGS += -D_EGL_BUILT_IN_DRIVER_GLX
- libEGL_la_LIBADD += ../drivers/glx/libegl_glx.la
- diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
- index 985e781..da8136c 100644
- --- a/src/egl/main/egldisplay.c
- +++ b/src/egl/main/egldisplay.c
- @@ -59,7 +59,9 @@
- #include <sys/types.h>
- #include <sys/stat.h>
- #endif
- -
- +#ifdef HAVE_MIR_PLATFORM
- +#include <mir_client_library.h>
- +#endif
- /**
- * Map --with-egl-platforms names to platform types.
- @@ -74,7 +76,8 @@ static const struct {
- { _EGL_PLATFORM_DRM, "drm" },
- { _EGL_PLATFORM_FBDEV, "fbdev" },
- { _EGL_PLATFORM_NULL, "null" },
- - { _EGL_PLATFORM_ANDROID, "android" }
- + { _EGL_PLATFORM_ANDROID, "android" },
- + { _EGL_PLATFORM_MIR, "mir" },
- };
- @@ -154,6 +157,11 @@ _eglNativePlatformDetectNativeDisplay(EGLNativeDisplayType nativeDisplay)
- return _EGL_PLATFORM_FBDEV;
- #endif
- +#ifdef HAVE_MIR_PLATFORM
- + if (mir_connection_is_valid(nativeDisplay))
- + return _EGL_PLATFORM_MIR;
- +#endif
- +
- if (_eglPointerIsDereferencable(nativeDisplay)) {
- void *first_pointer = *(void **) nativeDisplay;
- diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
- index 4b33470..3999d22 100644
- --- a/src/egl/main/egldisplay.h
- +++ b/src/egl/main/egldisplay.h
- @@ -46,6 +46,7 @@ enum _egl_platform_type {
- _EGL_PLATFORM_FBDEV,
- _EGL_PLATFORM_NULL,
- _EGL_PLATFORM_ANDROID,
- + _EGL_PLATFORM_MIR,
- _EGL_NUM_PLATFORMS,
- _EGL_INVALID_PLATFORM = -1
- diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
- index 519929e..a157bae 100644
- --- a/src/gbm/backends/dri/gbm_dri.c
- +++ b/src/gbm/backends/dri/gbm_dri.c
- @@ -44,6 +44,8 @@
- #include "gbm_driint.h"
- #include "gbmint.h"
- +#include <xf86drm.h>
- +
- /* For importing wl_buffer */
- #if HAVE_WAYLAND_PLATFORM
- @@ -281,9 +283,11 @@ gbm_dri_is_format_supported(struct gbm_device *gbm,
- switch (format) {
- case GBM_BO_FORMAT_XRGB8888:
- case GBM_FORMAT_XRGB8888:
- + case GBM_FORMAT_XBGR8888:
- break;
- case GBM_BO_FORMAT_ARGB8888:
- case GBM_FORMAT_ARGB8888:
- + case GBM_FORMAT_ABGR8888:
- if (usage & GBM_BO_USE_SCANOUT)
- return 0;
- break;
- @@ -348,6 +352,9 @@ gbm_dri_to_gbm_format(uint32_t dri_format)
- case __DRI_IMAGE_FORMAT_ABGR8888:
- ret = GBM_FORMAT_ABGR8888;
- break;
- + case __DRI_IMAGE_FORMAT_XBGR8888:
- + ret = GBM_FORMAT_XBGR8888;
- + break;
- default:
- ret = 0;
- break;
- @@ -545,10 +552,15 @@ gbm_dri_bo_create(struct gbm_device *gbm,
- case GBM_FORMAT_ABGR8888:
- dri_format = __DRI_IMAGE_FORMAT_ABGR8888;
- break;
- + case GBM_FORMAT_XBGR8888:
- + dri_format = __DRI_IMAGE_FORMAT_XBGR8888;
- + break;
- default:
- return NULL;
- }
- + bo->base.base.format = gbm_dri_to_gbm_format(dri_format);
- +
- if (usage & GBM_BO_USE_SCANOUT)
- dri_use |= __DRI_IMAGE_USE_SCANOUT;
- if (usage & GBM_BO_USE_CURSOR_64X64)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement