diff mbox

[RFC,031/111] staging: etnaviv: add gem operations structure to etnaviv objects

Message ID 1427988653-754-32-git-send-email-l.stach@pengutronix.de (mailing list archive)
State New, archived
Headers show

Commit Message

Lucas Stach April 2, 2015, 3:29 p.m. UTC
From: Russell King <rmk+kernel@arm.linux.org.uk>

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 drivers/staging/etnaviv/etnaviv_gem.c | 4 +++-
 drivers/staging/etnaviv/etnaviv_gem.h | 7 +++++++
 2 files changed, 10 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/staging/etnaviv/etnaviv_gem.c b/drivers/staging/etnaviv/etnaviv_gem.c
index 9e3cd61507d1..eface33ad445 100644
--- a/drivers/staging/etnaviv/etnaviv_gem.c
+++ b/drivers/staging/etnaviv/etnaviv_gem.c
@@ -536,7 +536,9 @@  static void etnaviv_free_obj(struct drm_gem_object *obj)
 
 	drm_gem_free_mmap_offset(obj);
 
-	if (obj->import_attach) {
+	if (etnaviv_obj->ops) {
+		etnaviv_obj->ops->release(etnaviv_obj);
+	} else if (obj->import_attach) {
 		if (etnaviv_obj->vaddr)
 			dma_buf_vunmap(obj->import_attach->dmabuf,
 				       etnaviv_obj->vaddr);
diff --git a/drivers/staging/etnaviv/etnaviv_gem.h b/drivers/staging/etnaviv/etnaviv_gem.h
index 97302ca6efaa..676cbd46c600 100644
--- a/drivers/staging/etnaviv/etnaviv_gem.h
+++ b/drivers/staging/etnaviv/etnaviv_gem.h
@@ -21,8 +21,11 @@ 
 #include <linux/reservation.h>
 #include "etnaviv_drv.h"
 
+struct etnaviv_gem_ops;
+
 struct etnaviv_gem_object {
 	struct drm_gem_object base;
+	const struct etnaviv_gem_ops *ops;
 
 	uint32_t flags;
 
@@ -64,6 +67,10 @@  struct etnaviv_gem_object {
 };
 #define to_etnaviv_bo(x) container_of(x, struct etnaviv_gem_object, base)
 
+struct etnaviv_gem_ops {
+	void (*release)(struct etnaviv_gem_object *);
+};
+
 static inline bool is_active(struct etnaviv_gem_object *etnaviv_obj)
 {
 	return etnaviv_obj->gpu != NULL;