rpms/libdrm/devel libdrm-master.patch,NONE,1.1 libdrm.spec,1.91,1.92

Dave Airlie airlied at fedoraproject.org
Tue Feb 2 23:50:04 UTC 2010


Author: airlied

Update of /cvs/pkgs/rpms/libdrm/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv19768

Modified Files:
	libdrm.spec 
Added Files:
	libdrm-master.patch 
Log Message:
* Wed Feb 03 2010 Dave Airlie <airlied at redhat.com> 2.4.17-2
- update to git master


libdrm-master.patch:
 Makefile.am                |    6 
 configure.ac               |   38 
 include/drm/Makefile.am    |    5 
 include/drm/nouveau_drm.h  |    1 
 include/drm/vmwgfx_drm.h   |  574 ++++
 intel/intel_atomic.h       |   15 
 intel/intel_bufmgr_fake.c  |    5 
 intel/intel_bufmgr_gem.c   |    3 
 intel/libdrm_intel.pc.in   |    3 
 libkms/Makefile.am         |   29 
 libkms/api.c               |  138 +
 libkms/intel.c             |  240 +
 libkms/internal.h          |   71 
 libkms/libkms.h            |   74 
 libkms/libkms.pc.in        |   10 
 libkms/linux.c             |  215 +
 libkms/vmwgfx.c            |  207 +
 nouveau/nouveau_channel.c  |   12 
 nouveau/nouveau_class.h    | 5408 ++++++++++++++++++++++++---------------------
 nouveau/nouveau_private.h  |    2 
 nouveau/nouveau_pushbuf.c  |   16 
 nouveau/nouveau_pushbuf.h  |    8 
 nouveau/nouveau_resource.c |    9 
 nouveau/nouveau_resource.h |    3 
 radeon/libdrm_radeon.pc.in |    2 
 radeon/radeon_bo.c         |   60 
 radeon/radeon_bo.h         |   24 
 radeon/radeon_bo_gem.c     |   32 
 radeon/radeon_bo_gem.h     |    8 
 radeon/radeon_bo_int.h     |    4 
 radeon/radeon_cs.c         |   38 
 radeon/radeon_cs.h         |   48 
 radeon/radeon_cs_gem.c     |  148 -
 radeon/radeon_cs_gem.h     |    8 
 radeon/radeon_cs_space.c   |  170 -
 tests/Makefile.am          |    4 
 tests/drmstat.c            |   10 
 tests/kmstest/Makefile.am  |   17 
 tests/kmstest/main.c       |   90 
 xf86drmMode.c              |  129 -
 40 files changed, 5108 insertions(+), 2776 deletions(-)

--- NEW FILE libdrm-master.patch ---
diff --git a/Makefile.am b/Makefile.am
index 41e5a34..ee3ccc7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -25,6 +25,10 @@ DISTCHECK_CONFIGURE_FLAGS = --enable-nouveau-experimental-api --enable-radeon-ex
 pkgconfigdir = @pkgconfigdir@
 pkgconfig_DATA = libdrm.pc
 
+if HAVE_LIBKMS
+LIBKMS_SUBDIR = libkms
+endif
+
 if HAVE_INTEL
 INTEL_SUBDIR = intel
 endif
@@ -37,7 +41,7 @@ if HAVE_RADEON
 RADEON_SUBDIR = radeon
 endif
 
-SUBDIRS = . $(INTEL_SUBDIR) $(NOUVEAU_SUBDIR) $(RADEON_SUBDIR) tests include
+SUBDIRS = . $(LIBKMS_SUBDIR) $(INTEL_SUBDIR) $(NOUVEAU_SUBDIR) $(RADEON_SUBDIR) tests include
 
 libdrm_la_LTLIBRARIES = libdrm.la
 libdrm_ladir = $(libdir)
diff --git a/configure.ac b/configure.ac
index 81523c3..185579c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,6 +32,7 @@ AC_PROG_CC
 
 AC_HEADER_STDC
 AC_SYS_LARGEFILE
+AC_FUNC_ALLOCA
 
 PKG_CHECK_MODULES(PTHREADSTUBS, pthread-stubs)
 AC_SUBST(PTHREADSTUBS_CFLAGS)
@@ -43,20 +44,31 @@ AC_ARG_ENABLE(udev,	AS_HELP_STRING([--enable-udev],
 				[Enable support for using udev instead of mknod (default: disabled)]),
 				[UDEV=$enableval], [UDEV=no])
 
+AC_ARG_ENABLE(libkms,
+	      AS_HELP_STRING([--enable-libkms],
+	      [Enable KMS mm abstraction library (default: disabled)]),
+	      [LIBKMS=$enableval], [LIBKMS=no])
+
 AC_ARG_ENABLE(intel,
 	      AS_HELP_STRING([--disable-intel],
 	      [Enable support for intel's KMS API (default: auto)]),
 	      [INTEL=$enableval], [INTEL=auto])
 
+AC_ARG_ENABLE(radeon,
+	      AS_HELP_STRING([--disable-radeon],
+	      [Enable support for radeon's KMS API (default: enabled)]),
+	      [RADEON=$enableval], [RADEON=yes])
+
+AC_ARG_ENABLE(vmwgfx-experimental-api,
+	      AS_HELP_STRING([--enable-vmwgfx-experimental-api],
+	      [Install vmwgfx's experimental kernel API header (default: disabled)]),
+	      [VMWGFX=$enableval], [VMWGFX=no])
+
 AC_ARG_ENABLE(nouveau-experimental-api,
 	      AS_HELP_STRING([--enable-nouveau-experimental-api],
 	      [Enable support for nouveau's experimental API (default: disabled)]),
 	      [NOUVEAU=$enableval], [NOUVEAU=no])
 
-AC_ARG_ENABLE(radeon-experimental-api,
-	      AS_HELP_STRING([--enable-radeon-experimental-api],
-	      [Enable support for radeon's KMS API (default: disabled)]),
-	      [RADEON=$enableval], [RADEON=no])
 
 dnl ===========================================================================
 dnl check compiler flags
@@ -134,6 +146,13 @@ if test "x$UDEV" = xyes; then
 	AC_DEFINE(UDEV, 1, [Have UDEV support])
 fi
 
+AM_CONDITIONAL(HAVE_LIBKMS, [test "x$LIBKMS" = xyes])
+
+AM_CONDITIONAL(HAVE_VMWGFX, [test "x$VMWGFX" = xyes])
+if test "x$VMWGFX" = xyes; then
+	AC_DEFINE(HAVE_VMWGFX, 1, [Have vmwgfx kernel headers])
+fi
+
 AM_CONDITIONAL(HAVE_NOUVEAU, [test "x$NOUVEAU" = xyes])
 
 AM_CONDITIONAL(HAVE_RADEON, [test "x$RADEON" = xyes])
@@ -168,6 +187,12 @@ if test "x$INTEL" != "xno"; then
 		    AC_CHECK_HEADER([atomic_ops.h], drm_cv_atomic_primitives="libatomic-ops")
 	    fi
 
+	    # atomic functions defined in <atomic.h> & libc on Solaris
+	    if test "x$drm_cv_atomic_primitives" = "xnone"; then
+		    AC_CHECK_FUNC([atomic_cas_uint],
+				  drm_cv_atomic_primitives="Solaris")
+	    fi
+
     ])
     if test "x$drm_cv_atomic_primitives" = xIntel; then
 	    AC_DEFINE(HAVE_INTEL_ATOMIC_PRIMITIVES, 1,
@@ -199,6 +224,8 @@ AC_SUBST(kernel_source)
 AC_SUBST(WARN_CFLAGS)
 AC_OUTPUT([
 	Makefile
+	libkms/Makefile
+	libkms/libkms.pc
 	intel/Makefile
 	intel/libdrm_intel.pc
 	radeon/Makefile
@@ -208,6 +235,7 @@ AC_OUTPUT([
 	tests/Makefile
 	tests/modeprint/Makefile
 	tests/modetest/Makefile
+	tests/kmstest/Makefile
 	include/Makefile
 	include/drm/Makefile
 	libdrm.pc])
@@ -215,7 +243,9 @@ AC_OUTPUT([
 echo ""
 echo "$PACKAGE_STRING will be compiled with:"
 echo ""
+echo "  libkms         $LIBKMS"
 echo "  Intel API      $INTEL"
+echo "  vmwgfx API     $VMWGFX"
 echo "  Radeon API     $RADEON"
 echo "  Nouveau API    $NOUVEAU"
 echo ""
diff --git a/include/drm/Makefile.am b/include/drm/Makefile.am
index 1db5acc..9046955 100644
--- a/include/drm/Makefile.am
+++ b/include/drm/Makefile.am
@@ -36,3 +36,8 @@ klibdrminclude_HEADERS = \
 	sis_drm.h \
 	via_drm.h \
 	mach64_drm.h
+
+
+if HAVE_VMWGFX
+klibdrminclude_HEADERS += vmwgfx_drm.h
+endif
diff --git a/include/drm/nouveau_drm.h b/include/drm/nouveau_drm.h
index 1e67c44..f745948 100644
--- a/include/drm/nouveau_drm.h
+++ b/include/drm/nouveau_drm.h
@@ -77,6 +77,7 @@ struct drm_nouveau_gpuobj_free {
 #define NOUVEAU_GETPARAM_PCI_PHYSICAL    10
 #define NOUVEAU_GETPARAM_CHIPSET_ID      11
 #define NOUVEAU_GETPARAM_VM_VRAM_BASE    12
+#define NOUVEAU_GETPARAM_GRAPH_UNITS     13
 struct drm_nouveau_getparam {
 	uint64_t param;
 	uint64_t value;
diff --git a/include/drm/vmwgfx_drm.h b/include/drm/vmwgfx_drm.h
new file mode 100644
index 0000000..2be7e12
--- /dev/null
+++ b/include/drm/vmwgfx_drm.h
@@ -0,0 +1,574 @@
+/**************************************************************************
+ *
+ * Copyright © 2009 VMware, Inc., Palo Alto, CA., USA
+ * All Rights Reserved.
+ *
+ * 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, sub license, 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 NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS 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.
+ *
+ **************************************************************************/
+
+#ifndef __VMWGFX_DRM_H__
+#define __VMWGFX_DRM_H__
+
+#define DRM_VMW_MAX_SURFACE_FACES 6
+#define DRM_VMW_MAX_MIP_LEVELS 24
+
+#define DRM_VMW_EXT_NAME_LEN 128
+
+#define DRM_VMW_GET_PARAM            0
+#define DRM_VMW_ALLOC_DMABUF         1
+#define DRM_VMW_UNREF_DMABUF         2
+#define DRM_VMW_CURSOR_BYPASS        3
+/* guarded by DRM_VMW_PARAM_NUM_STREAMS != 0*/
+#define DRM_VMW_CONTROL_STREAM       4
+#define DRM_VMW_CLAIM_STREAM         5
[...9847 lines suppressed...]
 
 drmModeResPtr drmModeGetResources(int fd)
 {
-	struct drm_mode_card_res res;
+	struct drm_mode_card_res res, counts;
 	drmModeResPtr r = 0;
 
+retry:
 	memset(&res, 0, sizeof(struct drm_mode_card_res));
-
 	if (drmIoctl(fd, DRM_IOCTL_MODE_GETRESOURCES, &res))
 		return 0;
 
-	if (res.count_fbs)
+	counts = res;
+
+	if (res.count_fbs) {
 		res.fb_id_ptr = VOID2U64(drmMalloc(res.count_fbs*sizeof(uint32_t)));
-	if (res.count_crtcs)
+		if (!res.fb_id_ptr)
+			goto err_allocs;
+	}
+	if (res.count_crtcs) {
 		res.crtc_id_ptr = VOID2U64(drmMalloc(res.count_crtcs*sizeof(uint32_t)));
-	if (res.count_connectors)
+		if (!res.crtc_id_ptr)
+			goto err_allocs;
+	}
+	if (res.count_connectors) {
 		res.connector_id_ptr = VOID2U64(drmMalloc(res.count_connectors*sizeof(uint32_t)));
-	if (res.count_encoders)
+		if (!res.connector_id_ptr)
+			goto err_allocs;
+	}
+	if (res.count_encoders) {
 		res.encoder_id_ptr = VOID2U64(drmMalloc(res.count_encoders*sizeof(uint32_t)));
+		if (!res.encoder_id_ptr)
+			goto err_allocs;
+	}
 
-	if (drmIoctl(fd, DRM_IOCTL_MODE_GETRESOURCES, &res)) {
-		r = NULL;
+	if (drmIoctl(fd, DRM_IOCTL_MODE_GETRESOURCES, &res))
 		goto err_allocs;
+
+	/* The number of available connectors and etc may have changed with a
+	 * hotplug event in between the ioctls, in which case the field is
+	 * silently ignored by the kernel.
+	 */
+	if (counts.count_fbs < res.count_fbs ||
+	    counts.count_crtcs < res.count_crtcs ||
+	    counts.count_connectors < res.count_connectors ||
+	    counts.count_encoders < res.count_encoders)
+	{
+		drmFree(U642VOID(res.fb_id_ptr));
+		drmFree(U642VOID(res.crtc_id_ptr));
+		drmFree(U642VOID(res.connector_id_ptr));
+		drmFree(U642VOID(res.encoder_id_ptr));
+
+		goto retry;
 	}
 
 	/*
 	 * return
 	 */
-
-
 	if (!(r = drmMalloc(sizeof(*r))))
-		return 0;
+		goto err_allocs;
 
 	r->min_width     = res.min_width;
 	r->max_width     = res.max_width;
@@ -174,11 +201,23 @@ drmModeResPtr drmModeGetResources(int fd)
 	r->count_crtcs   = res.count_crtcs;
 	r->count_connectors = res.count_connectors;
 	r->count_encoders = res.count_encoders;
-	/* TODO we realy should test if these allocs fails. */
-	r->fbs           = drmAllocCpy(U642VOID(res.fb_id_ptr), res.count_fbs, sizeof(uint32_t));
-	r->crtcs         = drmAllocCpy(U642VOID(res.crtc_id_ptr), res.count_crtcs, sizeof(uint32_t));
-	r->connectors       = drmAllocCpy(U642VOID(res.connector_id_ptr), res.count_connectors, sizeof(uint32_t));
-	r->encoders      = drmAllocCpy(U642VOID(res.encoder_id_ptr), res.count_encoders, sizeof(uint32_t));
+
+	r->fbs        = drmAllocCpy(U642VOID(res.fb_id_ptr), res.count_fbs, sizeof(uint32_t));
+	r->crtcs      = drmAllocCpy(U642VOID(res.crtc_id_ptr), res.count_crtcs, sizeof(uint32_t));
+	r->connectors = drmAllocCpy(U642VOID(res.connector_id_ptr), res.count_connectors, sizeof(uint32_t));
+	r->encoders   = drmAllocCpy(U642VOID(res.encoder_id_ptr), res.count_encoders, sizeof(uint32_t));
+	if ((res.count_fbs && !r->fbs) ||
+	    (res.count_crtcs && !r->crtcs) ||
+	    (res.count_connectors && !r->connectors) ||
+	    (res.count_encoders && !r->encoders))
+	{
+		drmFree(r->fbs);
+		drmFree(r->crtcs);
+		drmFree(r->connectors);
+		drmFree(r->encoders);
+		drmFree(r);
+		r = 0;
+	}
 
 err_allocs:
 	drmFree(U642VOID(res.fb_id_ptr));
@@ -371,37 +410,57 @@ drmModeEncoderPtr drmModeGetEncoder(int fd, uint32_t encoder_id)
 
 drmModeConnectorPtr drmModeGetConnector(int fd, uint32_t connector_id)
 {
-	struct drm_mode_get_connector conn;
+	struct drm_mode_get_connector conn, counts;
 	drmModeConnectorPtr r = NULL;
 
+retry:
+	memset(&conn, 0, sizeof(struct drm_mode_get_connector));
 	conn.connector_id = connector_id;
-	conn.connector_type_id = 0;
-	conn.connector_type  = 0;
-	conn.count_modes  = 0;
-	conn.modes_ptr    = 0;
-	conn.count_props  = 0;
-	conn.props_ptr    = 0;
-	conn.prop_values_ptr = 0;
-	conn.count_encoders  = 0;
-	conn.encoders_ptr = 0;
 
 	if (drmIoctl(fd, DRM_IOCTL_MODE_GETCONNECTOR, &conn))
 		return 0;
 
+	counts = conn;
+
 	if (conn.count_props) {
 		conn.props_ptr = VOID2U64(drmMalloc(conn.count_props*sizeof(uint32_t)));
+		if (!conn.props_ptr)
+			goto err_allocs;
 		conn.prop_values_ptr = VOID2U64(drmMalloc(conn.count_props*sizeof(uint64_t)));
+		if (!conn.prop_values_ptr)
+			goto err_allocs;
 	}
 
-	if (conn.count_modes)
+	if (conn.count_modes) {
 		conn.modes_ptr = VOID2U64(drmMalloc(conn.count_modes*sizeof(struct drm_mode_modeinfo)));
+		if (!conn.modes_ptr)
+			goto err_allocs;
+	}
 
-	if (conn.count_encoders)
+	if (conn.count_encoders) {
 		conn.encoders_ptr = VOID2U64(drmMalloc(conn.count_encoders*sizeof(uint32_t)));
+		if (!conn.encoders_ptr)
+			goto err_allocs;
+	}
 
 	if (drmIoctl(fd, DRM_IOCTL_MODE_GETCONNECTOR, &conn))
 		goto err_allocs;
 
+	/* The number of available connectors and etc may have changed with a
+	 * hotplug event in between the ioctls, in which case the field is
+	 * silently ignored by the kernel.
+	 */
+	if (counts.count_props < conn.count_props ||
+	    counts.count_modes < conn.count_modes ||
+	    counts.count_encoders < conn.count_encoders) {
+		drmFree(U642VOID(conn.props_ptr));
+		drmFree(U642VOID(conn.prop_values_ptr));
+		drmFree(U642VOID(conn.modes_ptr));
+		drmFree(U642VOID(conn.encoders_ptr));
+
+		goto retry;
+	}
+
 	if(!(r = drmMalloc(sizeof(*r)))) {
 		goto err_allocs;
 	}
@@ -414,7 +473,6 @@ drmModeConnectorPtr drmModeGetConnector(int fd, uint32_t connector_id)
 	/* convert subpixel from kernel to userspace */
 	r->subpixel     = conn.subpixel + 1;
 	r->count_modes  = conn.count_modes;
-	/* TODO we should test if these alloc & cpy fails. */
 	r->count_props  = conn.count_props;
 	r->props        = drmAllocCpy(U642VOID(conn.props_ptr), conn.count_props, sizeof(uint32_t));
 	r->prop_values  = drmAllocCpy(U642VOID(conn.prop_values_ptr), conn.count_props, sizeof(uint64_t));
@@ -424,8 +482,17 @@ drmModeConnectorPtr drmModeGetConnector(int fd, uint32_t connector_id)
 	r->connector_type  = conn.connector_type;
 	r->connector_type_id = conn.connector_type_id;
 
-	if (!r->props || !r->prop_values || !r->modes || !r->encoders)
-		goto err_allocs;
+	if ((r->count_props && !r->props) ||
+	    (r->count_props && !r->prop_values) ||
+	    (r->count_modes && !r->modes) ||
+	    (r->count_encoders && !r->encoders)) {
+		drmFree(r->props);
+		drmFree(r->prop_values);
+		drmFree(r->modes);
+		drmFree(r->encoders);
+		drmFree(r);
+		r = 0;
+	}
 
 err_allocs:
 	drmFree(U642VOID(conn.prop_values_ptr));


Index: libdrm.spec
===================================================================
RCS file: /cvs/pkgs/rpms/libdrm/devel/libdrm.spec,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -p -r1.91 -r1.92
--- libdrm.spec	21 Dec 2009 05:23:07 -0000	1.91
+++ libdrm.spec	2 Feb 2010 23:50:03 -0000	1.92
@@ -3,7 +3,7 @@
 Summary: Direct Rendering Manager runtime library
 Name: libdrm
 Version: 2.4.17
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: MIT
 Group: System Environment/Libraries
 URL: http://dri.sourceforge.net
@@ -22,6 +22,7 @@ BuildRequires: libudev-devel
 
 Source2: 91-drm-modeset.rules
 
+Patch1: libdrm-master.patch
 # hardcode the 666 instead of 660 for device nodes
 Patch3: libdrm-make-dri-perms-okay.patch
 # remove backwards compat not needed on Fedora
@@ -44,6 +45,7 @@ Direct Rendering Manager development pac
 %prep
 #%setup -q -n %{name}-%{gitdate}
 %setup -q 
+%patch1 -p1 -b .master
 %patch3 -p1 -b .forceperms
 %patch4 -p1 -b .no-bc
 
@@ -105,6 +107,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/pkgconfig/libdrm_nouveau.pc
 
 %changelog
+* Wed Feb 03 2010 Dave Airlie <airlied at redhat.com> 2.4.17-2
+- update to git master
+
 * Mon Dec 21 2009 Dave Airlie <airlied at redhat.com> 2.4.17-1
 - upstream released 2.4.17
 



More information about the scm-commits mailing list