From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753721Ab1GEOpo (ORCPT ); Tue, 5 Jul 2011 10:45:44 -0400 Received: from lxorguk.ukuu.org.uk ([81.2.110.251]:54167 "EHLO lxorguk.ukuu.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753659Ab1GEOpk (ORCPT ); Tue, 5 Jul 2011 10:45:40 -0400 From: Alan Cox Subject: [PATCH 10/49] gma500: GEM glue To: greg@kroah.com, linux-kernel@vger.kernel.org Date: Tue, 05 Jul 2011 15:35:55 +0100 Message-ID: <20110705143553.23872.6454.stgit@localhost.localdomain> In-Reply-To: <20110705141038.23872.55303.stgit@localhost.localdomain> References: <20110705141038.23872.55303.stgit@localhost.localdomain> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alan Cox Add this temporarily so we can keep making progress and also bundle all the GEM bits we need together in our staging driver while we get them into GEM itself. Signed-off-by: Alan Cox --- drivers/staging/gma500/Makefile | 3 ++ drivers/staging/gma500/gem_glue.c | 47 +++++++++++++++++++++++++++++++++++++ drivers/staging/gma500/gem_glue.h | 4 +++ 3 files changed, 53 insertions(+), 1 deletions(-) create mode 100644 drivers/staging/gma500/gem_glue.c create mode 100644 drivers/staging/gma500/gem_glue.h diff --git a/drivers/staging/gma500/Makefile b/drivers/staging/gma500/Makefile index db73ec6..01aaa28 100644 --- a/drivers/staging/gma500/Makefile +++ b/drivers/staging/gma500/Makefile @@ -3,7 +3,8 @@ # ccflags-y += -Iinclude/drm -psb_gfx-y += psb_bl.o \ +psb_gfx-y += gem_glue.o \ + psb_bl.o \ psb_drv.o \ psb_gem.o \ psb_fb.o \ diff --git a/drivers/staging/gma500/gem_glue.c b/drivers/staging/gma500/gem_glue.c new file mode 100644 index 0000000..0817497 --- /dev/null +++ b/drivers/staging/gma500/gem_glue.c @@ -0,0 +1,47 @@ +/************************************************************************** + * Copyright (c) 2011, Intel Corporation. + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + * + **************************************************************************/ + +#include +#include + +/** + * Initialize an already allocated GEM object of the specified size with + * no GEM provided backing store. Instead the caller is responsible for + * backing the object and handling it. + */ +int drm_gem_private_object_init(struct drm_device *dev, + struct drm_gem_object *obj, size_t size) +{ + BUG_ON((size & (PAGE_SIZE - 1)) != 0); + + obj->dev = dev; + obj->filp = NULL; + + kref_init(&obj->refcount); + atomic_set(&obj->handle_count, 0); + obj->size = size; + + return 0; +} + +void drm_gem_object_release_wrap(struct drm_gem_object *obj) +{ + if (obj->filp) + drm_gem_object_release(obj); +} diff --git a/drivers/staging/gma500/gem_glue.h b/drivers/staging/gma500/gem_glue.h new file mode 100644 index 0000000..c38285b --- /dev/null +++ b/drivers/staging/gma500/gem_glue.h @@ -0,0 +1,4 @@ +extern void drm_gem_object_release_wrap(struct drm_gem_object *obj); +extern int drm_gem_private_object_init(struct drm_device *dev, + struct drm_gem_object *obj, size_t size); +