[Bug 769293] vaapi/gl : Uploading to GL texture optimization
GStreamer (GNOME Bugzilla)
bugzilla at gnome.org
Wed Sep 21 06:52:49 UTC 2016
https://bugzilla.gnome.org/show_bug.cgi?id=769293
Hyunjun Ko <zzoon at igalia.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #335975|vaapitexturemap: created |[PATCH 1/3]
description|new vaapi object named |vaapitexturemap: created
|GstVaapiTextureMap |new vaapi object named
| |GstVaapiTextureMap
--- Comment #21 from Hyunjun Ko <zzoon at igalia.com> ---
Comment on attachment 335975
--> https://bugzilla.gnome.org/attachment.cgi?id=335975
[PATCH 1/3] vaapitexturemap: created new vaapi object named GstVaapiTextureMap
>From c6a1985ecdb786d9cb5eb794543fbe26bb7520d0 Mon Sep 17 00:00:00 2001
>From: Hyunjun Ko <zzoon at igalia.com>
>Date: Wed, 21 Sep 2016 15:41:56 +0900
>Subject: [PATCH 1/3] vaapitexturemap: created new vaapi object named
> GstVaapiTextureMap
>
>Create GstVaapiTextureMap to cache vaapi textures to be able to reuse,
>which has hash table of vaapi textures to manage.
>
>https://bugzilla.gnome.org/show_bug.cgi?id=769293
>---
> gst-libs/gst/vaapi/Makefile.am | 3 +
> gst-libs/gst/vaapi/gstvaapitexturemap.c | 105 +++++++++++++++++++++++++++
> gst-libs/gst/vaapi/gstvaapitexturemap.h | 48 ++++++++++++
> gst-libs/gst/vaapi/gstvaapitexturemap_priv.h | 53 ++++++++++++++
> 4 files changed, 209 insertions(+)
> create mode 100644 gst-libs/gst/vaapi/gstvaapitexturemap.c
> create mode 100644 gst-libs/gst/vaapi/gstvaapitexturemap.h
> create mode 100644 gst-libs/gst/vaapi/gstvaapitexturemap_priv.h
>
>diff --git a/gst-libs/gst/vaapi/Makefile.am b/gst-libs/gst/vaapi/Makefile.am
>index fc97c94..54cbc75 100644
>--- a/gst-libs/gst/vaapi/Makefile.am
>+++ b/gst-libs/gst/vaapi/Makefile.am
>@@ -73,6 +73,7 @@ libgstvaapi_source_c = \
> gstvaapisurfacepool.c \
> gstvaapisurfaceproxy.c \
> gstvaapitexture.c \
>+ gstvaapitexturemap.c \
> gstvaapiutils.c \
> gstvaapiutils_core.c \
> gstvaapiutils_h264.c \
>@@ -105,6 +106,7 @@ libgstvaapi_source_h = \
> gstvaapisurfacepool.h \
> gstvaapisurfaceproxy.h \
> gstvaapitexture.h \
>+ gstvaapitexturemap.h \
> gstvaapitypes.h \
> gstvaapiutils_h264.h \
> gstvaapiutils_h265.h \
>@@ -136,6 +138,7 @@ libgstvaapi_source_priv_h = \
> gstvaapisurface_priv.h \
> gstvaapisurfaceproxy_priv.h \
> gstvaapitexture_priv.h \
>+ gstvaapitexturemap_priv.h \
> gstvaapiutils.h \
> gstvaapiutils_core.h \
> gstvaapiutils_h264_priv.h \
>diff --git a/gst-libs/gst/vaapi/gstvaapitexturemap.c b/gst-libs/gst/vaapi/gstvaapitexturemap.c
>new file mode 100644
>index 0000000..b1b3c2d
>--- /dev/null
>+++ b/gst-libs/gst/vaapi/gstvaapitexturemap.c
>@@ -0,0 +1,105 @@
>+/*
>+ * gstvaapitexture.c - VA texture Hash map
>+ *
>+ * Copyright (C) 2016 Intel Corporation
>+ * Copyright (C) 2016 Igalia S.L.
>+ *
>+ * This library is free software; you can redistribute it and/or
>+ * modify it under the terms of the GNU Lesser General Public License
>+ * as published by the Free Software Foundation; either version 2.1
>+ * of the License, or (at your option) any later version.
>+ *
>+ * This library is distributed in the hope that it will be useful,
>+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
>+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>+ * Lesser General Public License for more details.
>+ *
>+ * You should have received a copy of the GNU Lesser General Public
>+ * License along with this library; if not, write to the Free
>+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
>+ * Boston, MA 02110-1301 USA
>+ */
>+
>+/**
>+ * SECTION:gstvaapitexturemap
>+ * @short_description: VA/GLX/EGL texture hash map abstraction
>+ */
>+
>+#include "gstvaapitexturemap.h"
>+#include "gstvaapitexturemap_priv.h"
>+
>+#define DEBUG 1
>+#include "gstvaapidebug.h"
>+
>+#define MAX_NUM_TEXTURE 10
>+
>+static void gst_vaapi_texture_map_finalize (GstVaapiTextureMap * map);
>+
>+GST_VAAPI_OBJECT_DEFINE_CLASS (GstVaapiTextureMap, gst_vaapi_texture_map);
>+
>+/**
>+ * gst_vaapi_texture_map_new:
>+ * @display: a #GstVaapiDisplay
>+ *
>+ * Creates a texture hash map.
>+ *
>+ * Return value: the newly created #GstVaapiTextureMap object
>+ */
>+GstVaapiTextureMap *
>+gst_vaapi_texture_map_new (GstVaapiDisplay * display)
>+{
>+ GstVaapiTextureMap *map;
>+
>+ map = gst_vaapi_object_new (gst_vaapi_texture_map_class (), display);
>+ if (!map)
>+ return NULL;
>+
>+ map->texture_map =
>+ g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL,
>+ (GDestroyNotify) gst_vaapi_texture_unref);
>+
>+ return map;
>+}
>+
>+static void
>+gst_vaapi_texture_map_finalize (GstVaapiTextureMap * map)
>+{
>+ if (map->texture_map) {
>+ g_hash_table_remove_all (map->texture_map);
>+ g_hash_table_destroy (map->texture_map);
>+ }
>+}
>+
>+gboolean
>+gst_vaapi_texture_map_add (GstVaapiTextureMap * map, GstVaapiTexture * texture,
>+ guint id)
>+{
>+ g_return_val_if_fail (map != NULL, FALSE);
>+ g_return_val_if_fail (map->texture_map != NULL, FALSE);
>+ g_return_val_if_fail (texture != NULL, FALSE);
>+
>+ if (g_hash_table_size (map->texture_map) > MAX_NUM_TEXTURE)
>+ gst_vaapi_texture_map_reset (map);
>+
>+ g_hash_table_insert (map->texture_map, GUINT_TO_POINTER (id), texture);
>+
>+ return TRUE;
>+}
>+
>+gpointer
>+gst_vaapi_texture_map_lookup (GstVaapiTextureMap * map, guint id)
>+{
>+ g_return_val_if_fail (map != NULL, NULL);
>+ g_return_val_if_fail (map->texture_map != NULL, NULL);
>+
>+ return g_hash_table_lookup (map->texture_map, GUINT_TO_POINTER (id));
>+}
>+
>+void
>+gst_vaapi_texture_map_reset (GstVaapiTextureMap * map)
>+{
>+ g_return_if_fail (map != NULL);
>+ g_return_if_fail (map->texture_map != NULL);
>+
>+ g_hash_table_remove_all (map->texture_map);
>+}
>diff --git a/gst-libs/gst/vaapi/gstvaapitexturemap.h b/gst-libs/gst/vaapi/gstvaapitexturemap.h
>new file mode 100644
>index 0000000..1b2982b
>--- /dev/null
>+++ b/gst-libs/gst/vaapi/gstvaapitexturemap.h
>@@ -0,0 +1,48 @@
>+/*
>+ * gstvaapitexturemap.h - VA texture Hash map
>+ *
>+ * Copyright (C) 2016 Intel Corporation
>+ * Copyright (C) 2016 Igalia S.L.
>+ *
>+ * This library is free software; you can redistribute it and/or
>+ * modify it under the terms of the GNU Lesser General Public License
>+ * as published by the Free Software Foundation; either version 2.1
>+ * of the License, or (at your option) any later version.
>+ *
>+ * This library is distributed in the hope that it will be useful,
>+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
>+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>+ * Lesser General Public License for more details.
>+ *
>+ * You should have received a copy of the GNU Lesser General Public
>+ * License along with this library; if not, write to the Free
>+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
>+ * Boston, MA 02110-1301 USA
>+ */
>+
>+#ifndef GST_VAAPI_TEXTURE_MAP_H
>+#define GST_VAAPI_TEXTURE_MAP_H
>+
>+#include <gst/vaapi/gstvaapitypes.h>
>+#include <gst/vaapi/gstvaapidisplay.h>
>+#include <gst/vaapi/gstvaapitexture.h>
>+
>+G_BEGIN_DECLS
>+
>+typedef struct _GstVaapiTextureMap GstVaapiTextureMap;
>+
>+GstVaapiTextureMap *
>+gst_vaapi_texture_map_new (GstVaapiDisplay * display);
>+
>+gboolean
>+gst_vaapi_texture_map_add (GstVaapiTextureMap * map, GstVaapiTexture * texture, guint id);
>+
>+gpointer
>+gst_vaapi_texture_map_lookup (GstVaapiTextureMap * map, guint id);
>+
>+void
>+gst_vaapi_texture_map_reset (GstVaapiTextureMap * map);
>+
>+G_END_DECLS
>+
>+#endif /* GST_VAAPI_TEXTURE_MAP_H */
>diff --git a/gst-libs/gst/vaapi/gstvaapitexturemap_priv.h b/gst-libs/gst/vaapi/gstvaapitexturemap_priv.h
>new file mode 100644
>index 0000000..660a994
>--- /dev/null
>+++ b/gst-libs/gst/vaapi/gstvaapitexturemap_priv.h
>@@ -0,0 +1,53 @@
>+/*
>+ * gstvaapitexturemap_priv.h - VA texture Hash map (private definitions)
>+ *
>+ * Copyright (C) 2016 Intel Corporation
>+ * Copyright (C) 2016 Igalia S.L.
>+ *
>+ * This library is free software; you can redistribute it and/or
>+ * modify it under the terms of the GNU Lesser General Public License
>+ * as published by the Free Software Foundation; either version 2.1
>+ * of the License, or (at your option) any later version.
>+ *
>+ * This library is distributed in the hope that it will be useful,
>+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
>+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>+ * Lesser General Public License for more details.
>+ *
>+ * You should have received a copy of the GNU Lesser General Public
>+ * License along with this library; if not, write to the Free
>+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
>+ * Boston, MA 02110-1301 USA
>+ */
>+
>+#ifndef GST_VAAPI_TEXTURE_MAP_PRIV_H
>+#define GST_VAAPI_TEXTURE_MAP_PRIV_H
>+
>+#include "gstvaapiobject_priv.h"
>+
>+G_BEGIN_DECLS
>+
>+typedef struct _GstVaapiTextureMapClass GstVaapiTextureMapClass;
>+
>+/**
>+ * GstVaapiTextureMap:
>+ *
>+ * Base class for API-dependent texture map.
>+ */
>+struct _GstVaapiTextureMap {
>+ GstVaapiObject parent_instance;
>+ GHashTable *texture_map;
>+};
>+
>+/**
>+ * GstVaapiTextureMapClass:
>+ *
>+ * Base class for API-dependent texture map.
>+ */
>+struct _GstVaapiTextureMapClass {
>+ GstVaapiObjectClass parent_class;
>+};
>+
>+G_END_DECLS
>+
>+#endif /* GST_VAAPI_TEXTURE_MAP_PRIV_H */
>--
>2.7.4
>
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
More information about the gstreamer-bugs
mailing list