summaryrefslogtreecommitdiff
path: root/lib/mesa/src/gbm/main
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2018-01-08 05:41:34 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2018-01-08 05:41:34 +0000
commitc00801de923e125863aaf8180439d59d610b2517 (patch)
treee2896aa2785f3cf2151aeeb3c95fb5cc09a2fe02 /lib/mesa/src/gbm/main
parentbe30e6efb92db21299b936c0e068e7088941e9c9 (diff)
Revert to Mesa 13.0.6 again.
Corruption has again been reported on Intel hardware running Xorg with the modesetting driver (which uses OpenGL based acceleration instead of SNA acceleration the intel driver defaults to). Reported in various forms on Sandy Bridge (X220), Ivy Bridge (X230) and Haswell (X240). Confirmed to not occur with the intel driver but the xserver was changed to default to the modesetting driver on >= gen4 hardware (except Ironlake). One means of triggering this is to open a large pdf with xpdf on an idle machine and highlight a section of the document. There have been reports of gpu hangs on gen4 intel hardware (T500 with GM45, X61 with 965GM) when starting Xorg as well.
Diffstat (limited to 'lib/mesa/src/gbm/main')
-rw-r--r--lib/mesa/src/gbm/main/common_drm.h48
-rw-r--r--lib/mesa/src/gbm/main/gbm.c148
-rw-r--r--lib/mesa/src/gbm/main/gbm.h45
-rw-r--r--lib/mesa/src/gbm/main/gbmint.h17
4 files changed, 69 insertions, 189 deletions
diff --git a/lib/mesa/src/gbm/main/common_drm.h b/lib/mesa/src/gbm/main/common_drm.h
new file mode 100644
index 000000000..d28c3f01f
--- /dev/null
+++ b/lib/mesa/src/gbm/main/common_drm.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright © 2011 Intel Corporation
+ *
+ * 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:
+ * Benjamin Franzke <benjaminfranzke@googlemail.com>
+ */
+
+#ifndef _COMMON_DRM_H_
+#define _COMMON_DRM_H_
+
+#include "gbmint.h"
+
+enum gbm_drm_driver_type {
+ GBM_DRM_DRIVER_TYPE_DRI,
+ GBM_DRM_DRIVER_TYPE_GALLIUM,
+};
+
+struct gbm_drm_device {
+ struct gbm_device base;
+ enum gbm_drm_driver_type type;
+ char *driver_name;
+};
+
+struct gbm_drm_bo {
+ struct gbm_bo base;
+};
+
+#endif
diff --git a/lib/mesa/src/gbm/main/gbm.c b/lib/mesa/src/gbm/main/gbm.c
index 1de14f8fb..9ef199001 100644
--- a/lib/mesa/src/gbm/main/gbm.c
+++ b/lib/mesa/src/gbm/main/gbm.c
@@ -137,7 +137,7 @@ gbm_create_device(int fd)
* \return The width of the allocated buffer object
*
*/
-GBM_EXPORT uint32_t
+GBM_EXPORT unsigned int
gbm_bo_get_width(struct gbm_bo *bo)
{
return bo->width;
@@ -148,7 +148,7 @@ gbm_bo_get_width(struct gbm_bo *bo)
* \param bo The buffer object
* \return The height of the allocated buffer object
*/
-GBM_EXPORT uint32_t
+GBM_EXPORT unsigned int
gbm_bo_get_height(struct gbm_bo *bo)
{
return bo->height;
@@ -165,20 +165,7 @@ gbm_bo_get_height(struct gbm_bo *bo)
GBM_EXPORT uint32_t
gbm_bo_get_stride(struct gbm_bo *bo)
{
- return gbm_bo_get_stride_for_plane(bo, 0);
-}
-
-/** Get the stride for the given plane
- *
- * \param bo The buffer object
- * \param plane for which you want the stride
- *
- * \sa gbm_bo_get_stride()
- */
-GBM_EXPORT uint32_t
-gbm_bo_get_stride_for_plane(struct gbm_bo *bo, int plane)
-{
- return bo->gbm->bo_get_stride(bo, plane);
+ return bo->stride;
}
/** Get the format of the buffer object
@@ -186,7 +173,7 @@ gbm_bo_get_stride_for_plane(struct gbm_bo *bo, int plane)
* The format of the pixels in the buffer.
*
* \param bo The buffer object
- * \return The format of buffer object, one of the GBM_FORMAT_* codes
+ * \return The format of buffer object, on of the GBM_FORMAT_* codes
*/
GBM_EXPORT uint32_t
gbm_bo_get_format(struct gbm_bo *bo)
@@ -194,32 +181,6 @@ gbm_bo_get_format(struct gbm_bo *bo)
return bo->format;
}
-/** Get the offset for the data of the specified plane
- *
- * Extra planes, and even the first plane, may have an offset from the start of
- * the buffer object. This function will provide the offset for the given plane
- * to be used in various KMS APIs.
- *
- * \param bo The buffer object
- * \return The offset
- */
-GBM_EXPORT uint32_t
-gbm_bo_get_offset(struct gbm_bo *bo, int plane)
-{
- return bo->gbm->bo_get_offset(bo, plane);
-}
-
-/** Get the gbm device used to create the buffer object
- *
- * \param bo The buffer object
- * \return Returns the gbm device with which the buffer object was created
- */
-GBM_EXPORT struct gbm_device *
-gbm_bo_get_device(struct gbm_bo *bo)
-{
- return bo->gbm;
-}
-
/** Get the handle of the buffer object
*
* This is stored in the platform generic union gbm_bo_handle type. However
@@ -251,53 +212,6 @@ gbm_bo_get_fd(struct gbm_bo *bo)
return bo->gbm->bo_get_fd(bo);
}
-/** Get the number of planes for the given bo.
- *
- * \param bo The buffer object
- * \return The number of planes
- */
-GBM_EXPORT int
-gbm_bo_get_plane_count(struct gbm_bo *bo)
-{
- return bo->gbm->bo_get_planes(bo);
-}
-
-/** Get the handle for the specified plane of the buffer object
- *
- * This function gets the handle for any plane associated with the BO. When
- * dealing with multi-planar formats, or formats which might have implicit
- * planes based on different underlying hardware it is necessary for the client
- * to be able to get this information to pass to the DRM.
- *
- * \param bo The buffer object
- * \param plane the plane to get a handle for
- *
- * \sa gbm_bo_get_handle()
- */
-GBM_EXPORT union gbm_bo_handle
-gbm_bo_get_handle_for_plane(struct gbm_bo *bo, int plane)
-{
- return bo->gbm->bo_get_handle(bo, plane);
-}
-
-/**
- * Get the chosen modifier for the buffer object
- *
- * This function returns the modifier that was chosen for the object. These
- * properties may be generic, or platform/implementation dependent.
- *
- * \param bo The buffer object
- * \return Returns the selected modifier (chosen by the implementation) for the
- * BO.
- * \sa gbm_bo_create_with_modifiers() where possible modifiers are set
- * \sa gbm_surface_create_with_modifiers() where possible modifiers are set
- * \sa define DRM_FORMAT_MOD_* in drm_fourcc.h for possible modifiers
- */
-GBM_EXPORT uint64_t
-gbm_bo_get_modifier(struct gbm_bo *bo)
-{
- return bo->gbm->bo_get_modifier(bo);
-}
/** Write data into the buffer object
*
@@ -318,6 +232,17 @@ gbm_bo_write(struct gbm_bo *bo, const void *buf, size_t count)
return bo->gbm->bo_write(bo, buf, count);
}
+/** Get the gbm device used to create the buffer object
+ *
+ * \param bo The buffer object
+ * \return Returns the gbm device with which the buffer object was created
+ */
+GBM_EXPORT struct gbm_device *
+gbm_bo_get_device(struct gbm_bo *bo)
+{
+ return bo->gbm;
+}
+
/** Set the user data associated with a buffer object
*
* \param bo The buffer object
@@ -388,28 +313,9 @@ gbm_bo_create(struct gbm_device *gbm,
return NULL;
}
- return gbm->bo_create(gbm, width, height, format, usage, NULL, 0);
+ return gbm->bo_create(gbm, width, height, format, usage);
}
-GBM_EXPORT struct gbm_bo *
-gbm_bo_create_with_modifiers(struct gbm_device *gbm,
- uint32_t width, uint32_t height,
- uint32_t format,
- const uint64_t *modifiers,
- const unsigned int count)
-{
- if (width == 0 || height == 0) {
- errno = EINVAL;
- return NULL;
- }
-
- if ((count && !modifiers) || (modifiers && !count)) {
- errno = EINVAL;
- return NULL;
- }
-
- return gbm->bo_create(gbm, width, height, format, 0, modifiers, count);
-}
/**
* Create a gbm buffer object from an foreign object
*
@@ -426,8 +332,8 @@ gbm_bo_create_with_modifiers(struct gbm_device *gbm,
* independent of the foreign object.
*
* \param gbm The gbm device returned from gbm_create_device()
- * \param type The type of object we're importing
- * \param buffer Pointer to the external object
+ * \param gbm The type of object we're importing
+ * \param gbm Pointer to the external object
* \param usage The union of the usage flags for this buffer
*
* \return A newly allocated buffer object that should be freed with
@@ -515,23 +421,7 @@ gbm_surface_create(struct gbm_device *gbm,
uint32_t width, uint32_t height,
uint32_t format, uint32_t flags)
{
- return gbm->surface_create(gbm, width, height, format, flags, NULL, 0);
-}
-
-GBM_EXPORT struct gbm_surface *
-gbm_surface_create_with_modifiers(struct gbm_device *gbm,
- uint32_t width, uint32_t height,
- uint32_t format,
- const uint64_t *modifiers,
- const unsigned int count)
-{
- if ((count && !modifiers) || (modifiers && !count)) {
- errno = EINVAL;
- return NULL;
- }
-
- return gbm->surface_create(gbm, width, height, format, 0,
- modifiers, count);
+ return gbm->surface_create(gbm, width, height, format, flags);
}
/**
diff --git a/lib/mesa/src/gbm/main/gbm.h b/lib/mesa/src/gbm/main/gbm.h
index 879f003f1..59daaa164 100644
--- a/lib/mesa/src/gbm/main/gbm.h
+++ b/lib/mesa/src/gbm/main/gbm.h
@@ -77,12 +77,6 @@ enum gbm_bo_format {
GBM_BO_FORMAT_ARGB8888
};
-
-/**
- * The FourCC format codes are taken from the drm_fourcc.h definition, and
- * re-namespaced. New GBM formats must not be added, unless they are
- * identical ports from drm_fourcc.
- */
#define __gbm_fourcc_code(a,b,c,d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | \
((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
@@ -249,16 +243,9 @@ gbm_bo_create(struct gbm_device *gbm,
uint32_t width, uint32_t height,
uint32_t format, uint32_t flags);
-struct gbm_bo *
-gbm_bo_create_with_modifiers(struct gbm_device *gbm,
- uint32_t width, uint32_t height,
- uint32_t format,
- const uint64_t *modifiers,
- const unsigned int count);
#define GBM_BO_IMPORT_WL_BUFFER 0x5501
#define GBM_BO_IMPORT_EGL_IMAGE 0x5502
#define GBM_BO_IMPORT_FD 0x5503
-#define GBM_BO_IMPORT_FD_MODIFIER 0x5504
struct gbm_import_fd_data {
int fd;
@@ -268,17 +255,6 @@ struct gbm_import_fd_data {
uint32_t format;
};
-struct gbm_import_fd_modifier_data {
- uint32_t width;
- uint32_t height;
- uint32_t format;
- uint32_t num_fds;
- int fds[4];
- int strides[4];
- int offsets[4];
- uint64_t modifier;
-};
-
struct gbm_bo *
gbm_bo_import(struct gbm_device *gbm, uint32_t type,
void *buffer, uint32_t usage);
@@ -328,14 +304,8 @@ uint32_t
gbm_bo_get_stride(struct gbm_bo *bo);
uint32_t
-gbm_bo_get_stride_for_plane(struct gbm_bo *bo, int plane);
-
-uint32_t
gbm_bo_get_format(struct gbm_bo *bo);
-uint32_t
-gbm_bo_get_offset(struct gbm_bo *bo, int plane);
-
struct gbm_device *
gbm_bo_get_device(struct gbm_bo *bo);
@@ -345,15 +315,6 @@ gbm_bo_get_handle(struct gbm_bo *bo);
int
gbm_bo_get_fd(struct gbm_bo *bo);
-uint64_t
-gbm_bo_get_modifier(struct gbm_bo *bo);
-
-int
-gbm_bo_get_plane_count(struct gbm_bo *bo);
-
-union gbm_bo_handle
-gbm_bo_get_handle_for_plane(struct gbm_bo *bo, int plane);
-
int
gbm_bo_write(struct gbm_bo *bo, const void *buf, size_t count);
@@ -372,12 +333,6 @@ gbm_surface_create(struct gbm_device *gbm,
uint32_t width, uint32_t height,
uint32_t format, uint32_t flags);
-struct gbm_surface *
-gbm_surface_create_with_modifiers(struct gbm_device *gbm,
- uint32_t width, uint32_t height,
- uint32_t format,
- const uint64_t *modifiers,
- const unsigned int count);
int
gbm_surface_needs_lock_front_buffer(struct gbm_surface *surface);
diff --git a/lib/mesa/src/gbm/main/gbmint.h b/lib/mesa/src/gbm/main/gbmint.h
index c27a7a560..cfef5eea2 100644
--- a/lib/mesa/src/gbm/main/gbmint.h
+++ b/lib/mesa/src/gbm/main/gbmint.h
@@ -65,9 +65,7 @@ struct gbm_device {
struct gbm_bo *(*bo_create)(struct gbm_device *gbm,
uint32_t width, uint32_t height,
uint32_t format,
- uint32_t usage,
- const uint64_t *modifiers,
- const unsigned int count);
+ uint32_t usage);
struct gbm_bo *(*bo_import)(struct gbm_device *gbm, uint32_t type,
void *buffer, uint32_t usage);
void *(*bo_map)(struct gbm_bo *bo,
@@ -78,18 +76,11 @@ struct gbm_device {
void (*bo_unmap)(struct gbm_bo *bo, void *map_data);
int (*bo_write)(struct gbm_bo *bo, const void *buf, size_t data);
int (*bo_get_fd)(struct gbm_bo *bo);
- int (*bo_get_planes)(struct gbm_bo *bo);
- union gbm_bo_handle (*bo_get_handle)(struct gbm_bo *bo, int plane);
- uint32_t (*bo_get_stride)(struct gbm_bo *bo, int plane);
- uint32_t (*bo_get_offset)(struct gbm_bo *bo, int plane);
- uint64_t (*bo_get_modifier)(struct gbm_bo *bo);
void (*bo_destroy)(struct gbm_bo *bo);
struct gbm_surface *(*surface_create)(struct gbm_device *gbm,
uint32_t width, uint32_t height,
- uint32_t format, uint32_t flags,
- const uint64_t *modifiers,
- const unsigned count);
+ uint32_t format, uint32_t flags);
struct gbm_bo *(*surface_lock_front_buffer)(struct gbm_surface *surface);
void (*surface_release_buffer)(struct gbm_surface *surface,
struct gbm_bo *bo);
@@ -119,10 +110,6 @@ struct gbm_surface {
uint32_t height;
uint32_t format;
uint32_t flags;
- struct {
- uint64_t *modifiers;
- unsigned count;
- };
};
struct gbm_backend {