Mesa (master): r600g: handle DRM_API_HANDLE_TYPE_KMS in buffer_get_handle

Marek Olšák mareko at kemper.freedesktop.org
Sat Jun 19 19:00:35 PDT 2010


Module: Mesa
Branch: master
Commit: c85e53bebf325b00db175bc05886a9281e95b0cc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c85e53bebf325b00db175bc05886a9281e95b0cc

Author: Marek Olšák <maraeo at gmail.com>
Date:   Sun Jun 20 03:50:44 2010 +0200

r600g: handle DRM_API_HANDLE_TYPE_KMS in buffer_get_handle

---

 src/gallium/winsys/r600/drm/r600_drm.c |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/gallium/winsys/r600/drm/r600_drm.c b/src/gallium/winsys/r600/drm/r600_drm.c
index b772ff0..803049d 100644
--- a/src/gallium/winsys/r600/drm/r600_drm.c
+++ b/src/gallium/winsys/r600/drm/r600_drm.c
@@ -48,19 +48,22 @@ boolean r600_buffer_get_handle(struct radeon *rw,
 			       struct winsys_handle *whandle)
 {
 	struct drm_gem_flink flink;
-	struct r600_buffer* rbuffer;
-	int r;
+	struct r600_buffer* rbuffer = (struct r600_buffer*)buf;
 
-	rbuffer = (struct r600_buffer*)buf;
-	if (!rbuffer->flink) {
-		flink.handle = rbuffer->bo->handle;
-		r = ioctl(rw->fd, DRM_IOCTL_GEM_FLINK, &flink);
-		if (r) {
-			return FALSE;
+	if (whandle->type == DRM_API_HANDLE_TYPE_SHARED) {
+		if (!rbuffer->flink) {
+			flink.handle = rbuffer->bo->handle;
+
+			if (ioctl(rw->fd, DRM_IOCTL_GEM_FLINK, &flink)) {
+				return FALSE;
+			}
+
+			rbuffer->flink = flink.name;
 		}
-		rbuffer->flink = flink.name;
+		whandle->handle = rbuffer->flink;
+	} else if (whandle->type == DRM_API_HANDLE_TYPE_KMS) {
+		whandle->handle = rbuffer->bo->handle;
 	}
-	whandle->handle = rbuffer->flink;
 	return TRUE;
 }
 



More information about the mesa-commit mailing list