Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  visl-debugfs.c   Sprache: C

 
// SPDX-License-Identifier: GPL-2.0+
/*
 * Debugfs tracing for bitstream buffers. This is similar to VA-API's
 * LIBVA_TRACE_BUFDATA in that the raw bitstream can be dumped as a debugging
 * aid.
 *
 * Produces one file per OUTPUT buffer. Files are automatically cleared on
 * STREAMOFF unless the module parameter "keep_bitstream_buffers" is set.
 */


#include <linux/debugfs.h>
#include <linux/list.h>
#include <linux/mutex.h>
#include <media/v4l2-mem2mem.h>

#include "visl-debugfs.h"

int visl_debugfs_init(struct visl_dev *dev)
{
 dev->debugfs_root = debugfs_create_dir("visl", NULL);
 INIT_LIST_HEAD(&dev->bitstream_blobs);
 mutex_init(&dev->bitstream_lock);

 if (IS_ERR(dev->debugfs_root))
  return PTR_ERR(dev->debugfs_root);

 return visl_debugfs_bitstream_init(dev);
}

int visl_debugfs_bitstream_init(struct visl_dev *dev)
{
 dev->bitstream_debugfs = debugfs_create_dir("bitstream",
          dev->debugfs_root);
 if (IS_ERR(dev->bitstream_debugfs))
  return PTR_ERR(dev->bitstream_debugfs);

 return 0;
}

void visl_trace_bitstream(struct visl_ctx *ctx, struct visl_run *run)
{
 u8 *vaddr = vb2_plane_vaddr(&run->src->vb2_buf, 0);
 struct visl_blob *blob;
 size_t data_sz = vb2_get_plane_payload(&run->src->vb2_buf, 0);
 struct dentry *dentry;
 char name[32];

 blob  = kzalloc(sizeof(*blob), GFP_KERNEL);
 if (!blob)
  return;

 blob->blob.data = vzalloc(data_sz);
 if (!blob->blob.data)
  goto err_vmalloc;

 blob->blob.size = data_sz;
 snprintf(name, 32, "bitstream%d", run->src->sequence);

 memcpy(blob->blob.data, vaddr, data_sz);

 dentry = debugfs_create_blob(name, 0444, ctx->dev->bitstream_debugfs,
         &blob->blob);
 if (IS_ERR(dentry))
  goto err_debugfs;

 blob->dentry = dentry;

 mutex_lock(&ctx->dev->bitstream_lock);
 list_add_tail(&blob->list, &ctx->dev->bitstream_blobs);
 mutex_unlock(&ctx->dev->bitstream_lock);

 return;

err_debugfs:
 vfree(blob->blob.data);
err_vmalloc:
 kfree(blob);
}

void visl_debugfs_clear_bitstream(struct visl_dev *dev)
{
 struct visl_blob *blob;
 struct visl_blob *tmp;

 mutex_lock(&dev->bitstream_lock);
 if (list_empty(&dev->bitstream_blobs))
  goto unlock;

 list_for_each_entry_safe(blob, tmp, &dev->bitstream_blobs, list) {
  list_del(&blob->list);
  debugfs_remove(blob->dentry);
  vfree(blob->blob.data);
  kfree(blob);
 }

unlock:
 mutex_unlock(&dev->bitstream_lock);
}

void visl_debugfs_bitstream_deinit(struct visl_dev *dev)
{
 visl_debugfs_clear_bitstream(dev);
 debugfs_remove_recursive(dev->bitstream_debugfs);
 dev->bitstream_debugfs = NULL;
}

void visl_debugfs_deinit(struct visl_dev *dev)
{
 visl_debugfs_bitstream_deinit(dev);
 debugfs_remove_recursive(dev->debugfs_root);
 dev->debugfs_root = NULL;
}

Messung V0.5
C=97 H=89 G=93

¤ Dauer der Verarbeitung: 0.1 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge