And use them in va plugin.
Also, set as default logging category the vadisplay one.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2077>
#include "gstvavideoformat.h"
#include <va/va.h>
+/* XXX: find a better log category */
+#define GST_CAT_DEFAULT gst_va_display_debug
+GST_DEBUG_CATEGORY_EXTERN (gst_va_display_debug);
+
gboolean
va_destroy_surfaces (GstVaDisplay * display, VASurfaceID * surfaces,
gint num_surfaces)
}
return TRUE;
-
}
gboolean
#pragma once
-#include <gst/va/va_fwd.h>
+#include <gst/va/gstva.h>
#include <gst/video/video.h>
#include <va/va.h>
#include <va/va_drmcommon.h>
VASurfaceID surface,
guint32 flags,
VADRMPRIMESurfaceDescriptor * desc);
+
+GST_VA_API
gboolean va_sync_surface (GstVaDisplay * display,
VASurfaceID surface);
+GST_VA_API
gboolean va_check_surface (GstVaDisplay * display,
VASurfaceID surface);
+
gboolean va_copy_surface (GstVaDisplay * display,
VASurfaceID dst,
VASurfaceID src);
gboolean derived);
/* mapping */
+GST_VA_API
gboolean va_map_buffer (GstVaDisplay * display,
VABufferID buffer,
gpointer * data);
+GST_VA_API
gboolean va_unmap_buffer (GstVaDisplay * display,
VABufferID buffer);
#include "gstvafilter.h"
+#include <gst/va/vasurfaceimage.h>
#include <gst/video/video.h>
#include <va/va_drmcommon.h>
}
static gboolean
-_check_surface (GstVaDisplay * display, VASurfaceID surface)
-{
- VADisplay dpy = gst_va_display_get_va_dpy (display);
- VAStatus status;
- VASurfaceStatus state;
-
- status = vaQuerySurfaceStatus (dpy, surface, &state);
-
- if (status != VA_STATUS_SUCCESS)
- GST_ERROR ("vaQuerySurfaceStatus: %s", vaErrorStr (status));
-
- GST_LOG ("surface %#x status %d", surface, state);
-
- return (status == VA_STATUS_SUCCESS);
-}
-
-static gboolean
_fill_va_sample (GstVaFilter * self, GstVaSample * sample,
GstPadDirection direction)
{
/* @FIXME: in gallium vaQuerySurfaceStatus only seems to work with
* encoder's surfaces */
if (!GST_VA_DISPLAY_IS_IMPLEMENTATION (self->display, MESA_GALLIUM)) {
- if (!_check_surface (self->display, sample->surface))
+ if (!va_check_surface (self->display, sample->surface))
return FALSE;
}
#include <gst/codecparsers/gsth264bitwriter.h>
#include <gst/va/gstva.h>
+#include <gst/va/vasurfaceimage.h>
#include <gst/video/video.h>
#include <va/va_drmcommon.h>
guint coded_size;
goffset offset;
GstBuffer *buf;
- VADisplay dpy;
VASurfaceID surface;
- VAStatus status;
VACodedBufferSegment *seg, *seg_list;
- dpy = gst_va_display_get_va_dpy (self->display);
-
frame_enc = _enc_frame (frame);
/* Wait for encoding to finish */
surface = gst_va_encode_picture_get_raw_surface (frame_enc->picture);
- status = vaSyncSurface (dpy, surface);
- if (status != VA_STATUS_SUCCESS) {
- GST_WARNING_OBJECT (self, "vaSyncSurface: %s", vaErrorStr (status));
+ if (!va_sync_surface (self->display, surface))
goto error;
- }
seg_list = NULL;
- status = vaMapBuffer (dpy, frame_enc->picture->coded_buffer,
- (gpointer *) & seg_list);
- if (status != VA_STATUS_SUCCESS) {
- GST_WARNING_OBJECT (self, "vaMapBuffer: %s", vaErrorStr (status));
+ if (!va_map_buffer (self->display, frame_enc->picture->coded_buffer,
+ (gpointer *) & seg_list))
goto error;
- }
if (!seg_list) {
GST_WARNING_OBJECT (self, "coded buffer has no segment list");
offset += seg->size;
}
- status = vaUnmapBuffer (dpy, frame_enc->picture->coded_buffer);
- if (status != VA_STATUS_SUCCESS)
- GST_WARNING ("vaUnmapBuffer: %s", vaErrorStr (status));
+ va_unmap_buffer (self->display, frame_enc->picture->coded_buffer);
frame->pts =
self->start_pts + self->frame_duration * frame_enc->total_frame_count;