From da91dd75067edf322ff0fb61e3627a2979ecf3d3 Mon Sep 17 00:00:00 2001 From: Kitae Kim Date: Tue, 16 Dec 2014 15:14:15 +0900 Subject: [PATCH] brillcodec: use new debug channel macros Change-Id: I4d14ca5b75361e16da9178c4190c2eea381cb1f6 Signed-off-by: Kitae Kim --- tizen/src/hw/pci/maru_brillcodec.c | 303 +++++++++++++++--------------- tizen/src/hw/pci/maru_brillcodec_device.c | 62 +++--- tizen/src/hw/pci/maru_brillcodec_vaapi.c | 24 +-- tizen/src/hw/pci/maru_dxva2_plugin.c | 104 +++++----- 4 files changed, 240 insertions(+), 253 deletions(-) diff --git a/tizen/src/hw/pci/maru_brillcodec.c b/tizen/src/hw/pci/maru_brillcodec.c index 6c9a505..0430274 100644 --- a/tizen/src/hw/pci/maru_brillcodec.c +++ b/tizen/src/hw/pci/maru_brillcodec.c @@ -36,10 +36,10 @@ #include "libavformat/avformat.h" #include "libavutil/pixdesc.h" -#include "debug_ch.h" +#include "util/new_debug_ch.h" /* define debug channel */ -MULTI_DEBUG_CHANNEL(qemu, brillcodec); +DECLARE_DEBUG_CHANNEL(brillcodec); // device memory #define CODEC_META_DATA_SIZE (256) @@ -97,7 +97,7 @@ maru_profile_cb (gpointer user_data) qemu_mutex_unlock(&profile_mutex); total_latency_time = decoding_time + copying_time; - INFO("decoding fps=%d, latency=%f(decode=%f + get_picture=%f)\n", + LOG_INFO("decoding fps=%d, latency=%f(decode=%f + get_picture=%f)\n", decoding_fps, total_latency_time/decoding_fps, decoding_time/decoding_fps, copying_time/decoding_fps); @@ -279,13 +279,13 @@ static void *brillcodec_store_inbuf(MaruBrillCodecState *s, } else { memcpy(&readbuf_size, device_mem, sizeof(readbuf_size)); - TRACE("readbuf size: %d\n", readbuf_size); + LOG_TRACE("readbuf size: %d\n", readbuf_size); if (readbuf_size == 0) { - TRACE("inbuf size is 0. api_id %d, ctx_id %d, mem_offset %x\n", + LOG_TRACE("inbuf size is 0. api_id %d, ctx_id %d, mem_offset %x\n", ioparam->api_index, ioparam->ctx_index, ioparam->mem_offset); } else { readbuf = g_malloc0(readbuf_size); - TRACE("copy input buffer from guest. ctx_id: %d, mem_offset: %x\n", + LOG_TRACE("copy input buffer from guest. ctx_id: %d, mem_offset: %x\n", ioparam->ctx_index, ioparam->mem_offset); memcpy(readbuf, device_mem + size, readbuf_size); } @@ -321,7 +321,7 @@ static void brillcodec_push_readqueue(MaruBrillCodecState *s, case DEINIT: case FLUSH_BUFFERS: default: - TRACE("no buffer from guest\n"); + LOG_TRACE("no buffer from guest\n"); break; } @@ -373,14 +373,14 @@ void brillcodec_pop_writequeue(MaruBrillCodecState *s, uint32_t ctx_idx) DeviceMemEntry *elem = NULL; uint32_t mem_offset = 0; - TRACE("enter: %s\n", __func__); + LOG_TRACE("enter: %s\n", __func__); if (ctx_idx < 1 || ctx_idx > (CODEC_CONTEXT_MAX - 1)) { - ERR("invalid buffer index. %d\n", ctx_idx); + LOG_SEVERE("invalid buffer index. %d\n", ctx_idx); return; } - TRACE("pop_writeqeue. context index: %d\n", ctx_idx); + LOG_TRACE("pop_writeqeue. context index: %d\n", ctx_idx); elem = entry[ctx_idx]; if (elem) { mem_offset = s->ioparam.mem_offset; @@ -389,18 +389,18 @@ void brillcodec_pop_writequeue(MaruBrillCodecState *s, uint32_t ctx_idx) if (mem_offset < CODEC_MEM_SIZE) { elem->get_data(s->vaddr + mem_offset, elem->opaque, elem->data_size); } else { - TRACE("mem_offset is corrupted!!\n"); + LOG_TRACE("mem_offset is corrupted!!\n"); } - TRACE("pop_writequeue. release elem: %p\n", elem); + LOG_TRACE("pop_writequeue. release elem: %p\n", elem); g_free(elem); entry[ctx_idx] = NULL; } else { - TRACE("there is no buffer to copy data to guest\n"); + LOG_TRACE("there is no buffer to copy data to guest\n"); } - TRACE("leave: %s\n", __func__); + LOG_TRACE("leave: %s\n", __func__); } // threads @@ -408,7 +408,7 @@ static void maru_brill_codec_thread_exit(MaruBrillCodecState *s) { int index; - TRACE("enter: %s\n", __func__); + LOG_TRACE("enter: %s\n", __func__); /* stop to run dedicated threads. */ s->is_thread_running = false; @@ -417,7 +417,7 @@ static void maru_brill_codec_thread_exit(MaruBrillCodecState *s) qemu_thread_join(&s->threadpool.threads[index]); } - TRACE("destroy mutex and conditional.\n"); + LOG_TRACE("destroy mutex and conditional.\n"); qemu_mutex_destroy(&s->threadpool.mutex); qemu_cond_destroy(&s->threadpool.cond); @@ -426,7 +426,7 @@ static void maru_brill_codec_thread_exit(MaruBrillCodecState *s) s->threadpool.threads = NULL; } - TRACE("leave: %s\n", __func__); + LOG_TRACE("leave: %s\n", __func__); } void brillcodec_wakeup_threads(MaruBrillCodecState *s, int api_index) @@ -437,14 +437,14 @@ void brillcodec_wakeup_threads(MaruBrillCodecState *s, int api_index) memcpy(ioparam, &s->ioparam, sizeof(CodecParam)); - TRACE("wakeup thread. ctx_id: %u, api_id: %u, mem_offset: 0x%x\n", + LOG_TRACE("wakeup thread. ctx_id: %u, api_id: %u, mem_offset: 0x%x\n", ioparam->ctx_index, ioparam->api_index, ioparam->mem_offset); qemu_mutex_lock(&s->context_mutex); if (ioparam->api_index != INIT) { if (!CONTEXT(s, ioparam->ctx_index)->opened_context) { - INFO("abandon api %d for context %d\n", + LOG_INFO("abandon api %d for context %d\n", ioparam->api_index, ioparam->ctx_index); qemu_mutex_unlock(&s->context_mutex); return; @@ -459,14 +459,14 @@ void brillcodec_wakeup_threads(MaruBrillCodecState *s, int api_index) // W/A for threads starvation. while (s->idle_thread_cnt == 0) { qemu_mutex_unlock(&s->context_mutex); - TRACE("Worker threads are exhausted\n"); + LOG_TRACE("Worker threads are exhausted\n"); usleep(2000); // wait 2ms. qemu_mutex_lock(&s->context_mutex); } qemu_cond_signal(&s->threadpool.cond); qemu_mutex_unlock(&s->context_mutex); - TRACE("after sending conditional signal\n"); + LOG_TRACE("after sending conditional signal\n"); } void *brillcodec_threads(void *opaque) @@ -474,7 +474,7 @@ void *brillcodec_threads(void *opaque) MaruBrillCodecState *s = (MaruBrillCodecState *)opaque; bool ret = false; - TRACE("enter: %s\n", __func__); + LOG_TRACE("enter: %s\n", __func__); while (s->is_thread_running) { int ctx_id = 0, api_id = 0; @@ -497,7 +497,7 @@ void *brillcodec_threads(void *opaque) indata_buf = elem->data_buf; - TRACE("api_id: %d ctx_id: %d\n", api_id, ctx_id); + LOG_TRACE("api_id: %d ctx_id: %d\n", api_id, ctx_id); qemu_mutex_lock(&s->context_mutex); CONTEXT(s, ctx_id)->occupied_thread = true; @@ -505,41 +505,41 @@ void *brillcodec_threads(void *opaque) ret = codec_func_handler[api_id](s, ctx_id, indata_buf); if (!ret) { - ERR("fail api %d for context %d\n", api_id, ctx_id); + LOG_SEVERE("fail api %d for context %d\n", api_id, ctx_id); g_free(elem->param_buf); continue; } - TRACE("release a buffer of CodecParam\n"); + LOG_TRACE("release a buffer of CodecParam\n"); g_free(elem->param_buf); elem->param_buf = NULL; if (elem->data_buf) { if (elem->data_buf->opaque && !(s->memory_monopolizing & (1 << api_id))) { - TRACE("release inbuf\n"); + LOG_TRACE("release inbuf\n"); g_free(elem->data_buf->opaque); elem->data_buf->opaque = NULL; } - TRACE("release a buffer indata_buf\n"); + LOG_TRACE("release a buffer indata_buf\n"); g_free(elem->data_buf); elem->data_buf = NULL; } - TRACE("release an element of CodecDataStg\n"); + LOG_TRACE("release an element of CodecDataStg\n"); g_free(elem); qemu_mutex_lock(&s->context_mutex); if (CONTEXT(s, ctx_id)->requested_close) { - INFO("make worker thread to handle deinit\n"); + LOG_INFO("make worker thread to handle deinit\n"); // codec_deinit(s, ctx_id, NULL); brillcodec_release_context(s, ctx_id); CONTEXT(s, ctx_id)->requested_close = false; } qemu_mutex_unlock(&s->context_mutex); - TRACE("switch context to raise interrupt.\n"); + LOG_TRACE("switch context to raise interrupt.\n"); qemu_bh_schedule(s->codec_bh); qemu_mutex_lock(&s->context_mutex); @@ -549,7 +549,7 @@ void *brillcodec_threads(void *opaque) maru_brill_codec_thread_exit(s); - TRACE("leave: %s\n", __func__); + LOG_TRACE("leave: %s\n", __func__); return NULL; } @@ -562,9 +562,9 @@ void brillcodec_release_context(MaruBrillCodecState *s, int32_t ctx_id) DeviceMemEntry *wq_elem = NULL, *wnext = NULL; CodecDataStg *rq_elem = NULL, *rnext = NULL; - TRACE("enter: %s\n", __func__); + LOG_TRACE("enter: %s\n", __func__); - TRACE("release %d of context\n", ctx_id); + LOG_TRACE("release %d of context\n", ctx_id); qemu_mutex_lock(&s->threadpool.mutex); if (CONTEXT(s, ctx_id)->opened_context) { @@ -580,43 +580,43 @@ void brillcodec_release_context(MaruBrillCodecState *s, int32_t ctx_id) if (rq_elem && rq_elem->data_buf && (rq_elem->data_buf->ctx_id == ctx_id)) { - TRACE("remove unused node from codec_rq. ctx_id: %d\n", ctx_id); + LOG_TRACE("remove unused node from codec_rq. ctx_id: %d\n", ctx_id); qemu_mutex_lock(&s->context_queue_mutex); QTAILQ_REMOVE(&codec_rq, rq_elem, node); qemu_mutex_unlock(&s->context_queue_mutex); if (rq_elem && rq_elem->data_buf) { - TRACE("release rq_buffer: %p\n", rq_elem->data_buf); + LOG_TRACE("release rq_buffer: %p\n", rq_elem->data_buf); g_free(rq_elem->data_buf); } - TRACE("release rq_elem: %p\n", rq_elem); + LOG_TRACE("release rq_elem: %p\n", rq_elem); g_free(rq_elem); } else { - TRACE("no elem of %d context in the codec_rq.\n", ctx_id); + LOG_TRACE("no elem of %d context in the codec_rq.\n", ctx_id); } } QTAILQ_FOREACH_SAFE(wq_elem, &codec_wq, node, wnext) { if (wq_elem && wq_elem->ctx_id == ctx_id) { - TRACE("remove unused node from codec_wq. ctx_id: %d\n", ctx_id); + LOG_TRACE("remove unused node from codec_wq. ctx_id: %d\n", ctx_id); qemu_mutex_lock(&s->context_queue_mutex); QTAILQ_REMOVE(&codec_wq, wq_elem, node); qemu_mutex_unlock(&s->context_queue_mutex); if (wq_elem && wq_elem->opaque) { - TRACE("release wq_buffer: %p\n", wq_elem->opaque); + LOG_TRACE("release wq_buffer: %p\n", wq_elem->opaque); g_free(wq_elem->opaque); wq_elem->opaque = NULL; } - TRACE("release wq_elem: %p\n", wq_elem); + LOG_TRACE("release wq_elem: %p\n", wq_elem); g_free(wq_elem); } else { - TRACE("no elem of %d context in the codec_wq.\n", ctx_id); + LOG_TRACE("no elem of %d context in the codec_wq.\n", ctx_id); } } - TRACE("leave: %s\n", __func__); + LOG_TRACE("leave: %s\n", __func__); } struct codec_element { @@ -635,12 +635,12 @@ int brillcodec_query_list (MaruBrillCodecState *s) AVCodec *codec = NULL; /* register avcodec */ - TRACE("register avcodec\n"); + LOG_TRACE("register avcodec\n"); av_register_all(); codec = av_codec_next(NULL); if (!codec) { - ERR("failed to get codec info.\n"); + LOG_SEVERE("failed to get codec info.\n"); return -1; } @@ -663,7 +663,7 @@ int brillcodec_query_list (MaruBrillCodecState *s) } } } else { - ERR("unknown media type: %d\n", codec->type); + LOG_SEVERE("unknown media type: %d\n", codec->type); } memset(element, 0x00, sizeof(struct codec_element)); @@ -673,7 +673,7 @@ int brillcodec_query_list (MaruBrillCodecState *s) g_strlcpy(element->long_name, codec->long_name, sizeof(element->long_name)); memcpy(element->pix_fmts, codec_fmts, sizeof(codec_fmts)); - TRACE("register %s %s\n", codec->name, codec->decode ? "decoder" : "encoder"); + LOG_TRACE("register %s %s\n", codec->name, codec->decode ? "decoder" : "encoder"); ++element; @@ -689,13 +689,13 @@ int brillcodec_get_context_index(MaruBrillCodecState *s) { int ctx_id; - TRACE("enter: %s\n", __func__); + LOG_TRACE("enter: %s\n", __func__); // requires mutex_lock? its function is protected by critical section. qemu_mutex_lock(&s->threadpool.mutex); for (ctx_id = 1; ctx_id < CODEC_CONTEXT_MAX; ctx_id++) { if (CONTEXT(s, ctx_id)->occupied_context == false) { - TRACE("get %d of codec context successfully.\n", ctx_id); + LOG_TRACE("get %d of codec context successfully.\n", ctx_id); CONTEXT(s, ctx_id)->occupied_context = true; break; } @@ -703,12 +703,12 @@ int brillcodec_get_context_index(MaruBrillCodecState *s) qemu_mutex_unlock(&s->threadpool.mutex); if (ctx_id == CODEC_CONTEXT_MAX) { - ERR("failed to get available codec context. "); - ERR("try to run codec again.\n"); + LOG_SEVERE("failed to get available codec context. "); + LOG_SEVERE("try to run codec again.\n"); ctx_id = -1; } - TRACE("leave: %s\n", __func__); + LOG_TRACE("leave: %s\n", __func__); return ctx_id; } @@ -723,17 +723,17 @@ static bool flush_buffers(MaruBrillCodecState *s, int ctx_id, void *data_buf) AVCodecContext *avctx = NULL; bool ret = true; - TRACE("enter: %s\n", __func__); + LOG_TRACE("enter: %s\n", __func__); avctx = CONTEXT(s, ctx_id)->avctx; if (!avctx) { - ERR("%d of AVCodecContext is NULL.\n", ctx_id); + LOG_SEVERE("%d of AVCodecContext is NULL.\n", ctx_id); ret = false; } else if (!avctx->codec) { - ERR("%d of AVCodec is NULL.\n", ctx_id); + LOG_SEVERE("%d of AVCodec is NULL.\n", ctx_id); ret = false; } else { - TRACE("flush %d context of buffers.\n", ctx_id); + LOG_TRACE("flush %d context of buffers.\n", ctx_id); AVCodecParserContext *pctx = NULL; uint8_t *poutbuf = NULL; int poutbuf_size = 0; @@ -748,7 +748,7 @@ static bool flush_buffers(MaruBrillCodecState *s, int ctx_id, void *data_buf) if (pctx) { res = av_parser_parse2(pctx, avctx, &poutbuf, &poutbuf_size, p_inbuf, p_inbuf_size, -1, -1, -1); - INFO("before flush buffers, using parser. res: %d\n", res); + LOG_INFO("before flush buffers, using parser. res: %d\n", res); } avcodec_flush_buffers(avctx); @@ -756,7 +756,7 @@ static bool flush_buffers(MaruBrillCodecState *s, int ctx_id, void *data_buf) brillcodec_push_writequeue(s, NULL, 0, ctx_id, NULL); - TRACE("leave: %s\n", __func__); + LOG_TRACE("leave: %s\n", __func__); return ret; } @@ -826,7 +826,7 @@ static void default_get_picture(void *dst, void *src, enum AVPixelFormat pix_fmt int pict_size = avpicture_get_size(pix_fmt, frame->width, frame->height); if (pict_size < 0) { // cannot enter here... - ERR("Invalid picture size\n"); + LOG_SEVERE("Invalid picture size\n"); return; } avpicture_layout((AVPicture *)frame, pix_fmt, @@ -923,7 +923,7 @@ static uint32_t parse_and_decode_video(AVCodecContext *avctx, AVFrame *picture, parser_buf += ret; } - TRACE("after parsing ret: %d parser_outbuf_size %d parser_buf_size %d pts %lld\n", + LOG_TRACE("after parsing ret: %d parser_outbuf_size %d parser_buf_size %d pts %lld\n", ret, parser_outbuf_size, parser_buf_size, pctx->pts); /* if there is no output, we must break and wait for more data. @@ -931,10 +931,10 @@ static uint32_t parse_and_decode_video(AVCodecContext *avctx, AVFrame *picture, */ if (parser_outbuf_size == 0) { if (parser_buf_size > 0) { - TRACE("parsing data have been left\n"); + LOG_TRACE("parsing data have been left\n"); continue; } else { - TRACE("finish parsing data\n"); + LOG_TRACE("finish parsing data\n"); break; } } @@ -942,35 +942,35 @@ static uint32_t parse_and_decode_video(AVCodecContext *avctx, AVFrame *picture, packet->data = parser_outbuf; packet->size = parser_outbuf_size; } else { - TRACE("not using parser %s\n", avctx->codec->name); + LOG_TRACE("not using parser %s\n", avctx->codec->name); } // begin video decode profile BEGIN_VIDEO_DECODE_PROFILE(); len = avcodec_decode_video2(avctx, picture, (int *)got_picture, packet); - TRACE("decode_video. len %d, got_picture %d\n", len, *got_picture); + LOG_TRACE("decode_video. len %d, got_picture %d\n", len, *got_picture); // end video decode profile END_VIDEO_DECODE_PROFILE(); if (!pctx) { if (len == 0 && (*got_picture) == 0) { - ERR("decoding video didn't return any data! ctx_id %d len %d\n", ctx_id, len); + LOG_SEVERE("decoding video didn't return any data! ctx_id %d len %d\n", ctx_id, len); break; } else if (len < 0) { - ERR("decoding video error! ctx_id %d len %d\n", ctx_id, len); + LOG_SEVERE("decoding video error! ctx_id %d len %d\n", ctx_id, len); break; } parser_buf_size -= len; parser_buf += len; } else { if (len == 0) { - ERR("decoding video didn't return any data! ctx_id %d len %d\n", ctx_id, len); + LOG_SEVERE("decoding video didn't return any data! ctx_id %d len %d\n", ctx_id, len); *got_picture = 0; break; } else if (len < 0) { - ERR("decoding video error! trying next ctx_id %d len %d\n", ctx_id, len); + LOG_SEVERE("decoding video error! trying next ctx_id %d len %d\n", ctx_id, len); break; } } @@ -993,11 +993,11 @@ static bool decode_video_common(MaruBrillCodecState *s, int ctx_id, uint32_t got_picture = 0; int32_t len = -1; - TRACE("enter: %s\n", __func__); + LOG_TRACE("enter: %s\n", __func__); elem = (DeviceMemEntry *)data_buf; if (!elem || !elem->opaque) { - TRACE("decode_video. no input buffer\n"); + LOG_TRACE("decode_video. no input buffer\n"); } else { decode_input = elem->opaque; } @@ -1011,11 +1011,11 @@ static bool decode_video_common(MaruBrillCodecState *s, int ctx_id, pctx = CONTEXT(s, ctx_id)->parser_ctx; if (!avctx || !avctx->codec || !frame) { - ERR("critical error !!!\n"); + LOG_SEVERE("critical error !!!\n"); assert(0); } - TRACE("decode_video. bitrate %d resolution(%dx%d)\n", + LOG_TRACE("decode_video. bitrate %d resolution(%dx%d)\n", avctx->bit_rate, avctx->width, avctx->height); len = parse_and_decode_video(avctx, frame, pctx, ctx_id, @@ -1032,7 +1032,7 @@ static bool decode_video_common(MaruBrillCodecState *s, int ctx_id, brillcodec_push_writequeue(s, dc, 0, ctx_id, copy_video_decode_data); - TRACE("leave: %s\n", __func__); + LOG_TRACE("leave: %s\n", __func__); return true; } @@ -1051,16 +1051,16 @@ static bool picture_copy(MaruBrillCodecState *s, int ctx_id, void *elem) { DataContainer *dc = g_malloc0(sizeof(DataContainer)); - TRACE("enter: %s\n", __func__); + LOG_TRACE("enter: %s\n", __func__); - TRACE("copy decoded image of %d context.\n", ctx_id); + LOG_TRACE("copy decoded image of %d context.\n", ctx_id); dc->avctx = CONTEXT(s, ctx_id)->avctx; dc->frame = CONTEXT(s, ctx_id)->frame; brillcodec_push_writequeue(s, dc, 0, ctx_id, copy_video_decode_data); - TRACE("leave: %s\n", __func__); + LOG_TRACE("leave: %s\n", __func__); return true; } @@ -1078,11 +1078,11 @@ static bool encode_video(MaruBrillCodecState *s, int ctx_id, void *data_buf) struct video_encode_input empty_input = { 0, }; struct video_encode_input *encode_input = &empty_input; - TRACE("enter: %s\n", __func__); + LOG_TRACE("enter: %s\n", __func__); elem = (DeviceMemEntry *)data_buf; if (!elem || !elem->opaque) { - TRACE("encode_video. no input buffer\n"); + LOG_TRACE("encode_video. no input buffer\n"); } else { encode_input = elem->opaque; } @@ -1094,17 +1094,17 @@ static bool encode_video(MaruBrillCodecState *s, int ctx_id, void *data_buf) pict = CONTEXT(s, ctx_id)->frame; if(!avctx || !avctx->codec) { - ERR("critical error !!!\n"); + LOG_SEVERE("critical error !!!\n"); assert(0); } - TRACE("pixel format: %d inbuf: %p, picture data: %p\n", + LOG_TRACE("pixel format: %d inbuf: %p, picture data: %p\n", avctx->pix_fmt, inbuf, pict->data[0]); ret = avpicture_fill((AVPicture *)pict, &encode_input->inbuf, avctx->pix_fmt, avctx->width, avctx->height); if (ret < 0) { - ERR("after avpicture_fill, ret:%d\n", ret); + LOG_SEVERE("after avpicture_fill, ret:%d\n", ret); } else { if (avctx->time_base.num == 0) { pict->pts = AV_NOPTS_VALUE; @@ -1113,7 +1113,7 @@ static bool encode_video(MaruBrillCodecState *s, int ctx_id, void *data_buf) {1, (G_USEC_PER_SEC * G_GINT64_CONSTANT(1000))}; pict->pts = av_rescale_q(encode_input->in_timestamp, bq, avctx->time_base); } - TRACE("encode video. ticks_per_frame:%d, pts:%lld\n", + LOG_TRACE("encode video. ticks_per_frame:%d, pts:%lld\n", avctx->ticks_per_frame, pict->pts); outbuf_size = @@ -1126,9 +1126,9 @@ static bool encode_video(MaruBrillCodecState *s, int ctx_id, void *data_buf) ret = avcodec_encode_video2(avctx, avpkt, pict, &got_frame); - TRACE("encode video. ret %d got_frame %d outbuf_size %d\n", ret, got_frame, avpkt->size); + LOG_TRACE("encode video. ret %d got_frame %d outbuf_size %d\n", ret, got_frame, avpkt->size); if (avctx->coded_frame) { - TRACE("encode video. keyframe %d\n", avctx->coded_frame->key_frame); + LOG_TRACE("encode video. keyframe %d\n", avctx->coded_frame->key_frame); } } @@ -1140,7 +1140,7 @@ static bool encode_video(MaruBrillCodecState *s, int ctx_id, void *data_buf) brillcodec_push_writequeue(s, dc, 0, ctx_id, copy_video_encode_data); - TRACE("leave: %s\n", __func__); + LOG_TRACE("leave: %s\n", __func__); return true; } @@ -1191,7 +1191,7 @@ static int convert_audio_sample_fmt(const AVCodec *codec, int codec_type, bool e } if (codec_type != AVMEDIA_TYPE_AUDIO) { - ERR("this codec_type is invalid %d\n", codec_type); + LOG_SEVERE("this codec_type is invalid %d\n", codec_type); return audio_sample_fmt; } @@ -1216,10 +1216,10 @@ static int convert_audio_sample_fmt(const AVCodec *codec, int codec_type, bool e audio_sample_fmt = AV_SAMPLE_FMT_FLT; } } else { - INFO("cannot handle %s codec\n", codec->name); + LOG_INFO("cannot handle %s codec\n", codec->name); } - TRACE("convert audio sample_fmt %d\n", audio_sample_fmt); + LOG_TRACE("convert audio sample_fmt %d\n", audio_sample_fmt); return audio_sample_fmt; } @@ -1230,12 +1230,12 @@ static int fill_audio_into_frame(AVCodecContext *avctx, AVFrame *frame, int result = 0; if (!avctx) { - ERR("fill_audio. AVCodecContext is NULL!!\n"); + LOG_SEVERE("fill_audio. AVCodecContext is NULL!!\n"); return -1; } if (!frame) { - ERR("fill_audio. AVFrame is NULL!!\n"); + LOG_SEVERE("fill_audio. AVFrame is NULL!!\n"); return -1; } @@ -1245,7 +1245,7 @@ static int fill_audio_into_frame(AVCodecContext *avctx, AVFrame *frame, result = avcodec_fill_audio_frame(frame, avctx->channels, audio_sample_fmt, (const uint8_t *)samples, samples_size, 0); - TRACE("fill audio in_frame. ret: %d in_frame->ch_layout %lld\n", result, frame->channel_layout); + LOG_TRACE("fill audio in_frame. ret: %d in_frame->ch_layout %lld\n", result, frame->channel_layout); return result; } @@ -1262,11 +1262,11 @@ static AVFrame *resample_audio(AVCodecContext *avctx, AVFrame *sample_frame, avr = avresample_alloc_context(); if (!avr) { - ERR("failed to allocate avresample context\n"); + LOG_SEVERE("failed to allocate avresample context\n"); return NULL; } - TRACE("channel_layout %lld sample_rate %d in_sample_fmt %d resample_sample_fmt %d\n", + LOG_TRACE("channel_layout %lld sample_rate %d in_sample_fmt %d resample_sample_fmt %d\n", avctx->channel_layout, avctx->sample_rate, avctx->sample_fmt, resample_sample_fmt); av_opt_set_int(avr, "in_channel_layout", avctx->channel_layout, 0); @@ -1277,9 +1277,9 @@ static AVFrame *resample_audio(AVCodecContext *avctx, AVFrame *sample_frame, av_opt_set_int(avr, "out_sample_fmt", resample_sample_fmt, 0); av_opt_set_int(avr, "out_sample_rate", avctx->sample_rate, 0); - TRACE("open avresample context\n"); + LOG_TRACE("open avresample context\n"); if (avresample_open(avr) < 0) { - ERR("failed to open avresample context\n"); + LOG_SEVERE("failed to open avresample context\n"); avresample_free(&avr); return NULL; } @@ -1289,11 +1289,11 @@ static AVFrame *resample_audio(AVCodecContext *avctx, AVFrame *sample_frame, #else resample_frame = av_frame_alloc(); #endif - TRACE("resample audio. nb_samples %d sample_fmt %d\n", resample_nb_samples, resample_sample_fmt); + LOG_TRACE("resample audio. nb_samples %d sample_fmt %d\n", resample_nb_samples, resample_sample_fmt); *resample_buffer_size = av_samples_get_buffer_size(NULL, avctx->channels, resample_nb_samples, resample_sample_fmt, 0); if (*resample_buffer_size < 0) { - ERR("failed to get size of resample buffer %d\n", *resample_buffer_size); + LOG_SEVERE("failed to get size of resample buffer %d\n", *resample_buffer_size); avresample_close(avr); avresample_free(&avr); return NULL; @@ -1301,7 +1301,7 @@ static AVFrame *resample_audio(AVCodecContext *avctx, AVFrame *sample_frame, resample_buffer = av_mallocz(*resample_buffer_size); if (!resample_buffer) { - ERR("failed to allocate resample buffer\n"); + LOG_SEVERE("failed to allocate resample buffer\n"); avresample_close(avr); avresample_free(&avr); return NULL; @@ -1315,7 +1315,7 @@ static AVFrame *resample_audio(AVCodecContext *avctx, AVFrame *sample_frame, sample_frame->data, sample_buffer_size, sample_frame->nb_samples); - TRACE("resample_audio buffer_size %d\n", buffer_size); + LOG_TRACE("resample_audio buffer_size %d\n", buffer_size); avresample_close(avr); avresample_free(&avr); @@ -1384,11 +1384,11 @@ static bool decode_audio(MaruBrillCodecState *s, int ctx_id, void *data_buf) struct audio_decode_input *decode_input = &empty_input; int len = -1, got_frame = 0; - TRACE("enter: %s\n", __func__); + LOG_TRACE("enter: %s\n", __func__); elem = (DeviceMemEntry *)data_buf; if (!elem || !elem->opaque) { - TRACE("decode_audio. no input buffer\n"); + LOG_TRACE("decode_audio. no input buffer\n"); } else { decode_input = elem->opaque; } @@ -1401,12 +1401,12 @@ static bool decode_audio(MaruBrillCodecState *s, int ctx_id, void *data_buf) frame = CONTEXT(s, ctx_id)->frame; if(!avctx || !avctx->codec || !frame) { - ERR("critical error !!!\n"); + LOG_SEVERE("critical error !!!\n"); assert(0); } len = avcodec_decode_audio4(avctx, frame, &got_frame, &avpkt); - TRACE("decode_audio. len %d, channel_layout %lld, got_frame %d\n", + LOG_TRACE("decode_audio. len %d, channel_layout %lld, got_frame %d\n", len, avctx->channel_layout, got_frame); AVFrame *resample_frame = NULL; @@ -1419,14 +1419,14 @@ static bool decode_audio(MaruBrillCodecState *s, int ctx_id, void *data_buf) if (avctx->channel_layout == 0) { avctx->channel_layout = av_get_default_channel_layout(avctx->channels); - TRACE("decode_audio. channel_layout %lld channels %d\n", + LOG_TRACE("decode_audio. channel_layout %lld channels %d\n", avctx->channel_layout, avctx->channels); } resample_frame = resample_audio(avctx, frame, frame->linesize[0], avctx->sample_fmt, NULL, &resample_buf_size, out_sample_fmt); if (!resample_frame) { - ERR("failed to resample decoded audio buffer\n"); + LOG_SEVERE("failed to resample decoded audio buffer\n"); len = -1; got_frame = 0; } @@ -1443,7 +1443,7 @@ static bool decode_audio(MaruBrillCodecState *s, int ctx_id, void *data_buf) brillcodec_push_writequeue(s, dc, 0, ctx_id, ©_audio_decode_data); - TRACE("leave: %s\n", __func__); + LOG_TRACE("leave: %s\n", __func__); return true; } @@ -1460,7 +1460,7 @@ static bool encode_audio(MaruBrillCodecState *s, int ctx_id, void *data_buf) struct audio_encode_input empty_input = { 0, }; struct audio_encode_input *encode_input = &empty_input; - TRACE("enter: %s\n", __func__); + LOG_TRACE("enter: %s\n", __func__); /* * copy raw audio data from gstreamer encoder plugin @@ -1469,7 +1469,7 @@ static bool encode_audio(MaruBrillCodecState *s, int ctx_id, void *data_buf) */ elem = (DeviceMemEntry *)data_buf; if (!elem || !elem->opaque) { - TRACE("encode_audio. no input buffer\n"); + LOG_TRACE("encode_audio. no input buffer\n"); } else { encode_input = elem->opaque; } @@ -1480,7 +1480,7 @@ static bool encode_audio(MaruBrillCodecState *s, int ctx_id, void *data_buf) in_frame = CONTEXT(s, ctx_id)->frame; if (!avctx || !avctx->codec || !in_frame) { - ERR("critical error !!!\n"); + LOG_SEVERE("critical error !!!\n"); assert(0); } @@ -1494,16 +1494,16 @@ static bool encode_audio(MaruBrillCodecState *s, int ctx_id, void *data_buf) int ret = 0; bytes_per_sample = av_get_bytes_per_sample(audio_in_sample_fmt); - TRACE("bytes per sample %d, sample format %d\n", bytes_per_sample, audio_in_sample_fmt); + LOG_TRACE("bytes per sample %d, sample format %d\n", bytes_per_sample, audio_in_sample_fmt); nb_samples = encode_input->inbuf_size / (bytes_per_sample * avctx->channels); - TRACE("nb_samples %d\n", nb_samples); + LOG_TRACE("nb_samples %d\n", nb_samples); ret = fill_audio_into_frame(avctx, in_frame, &encode_input->inbuf, encode_input->inbuf_size, nb_samples, audio_in_sample_fmt); if (ret < 0) { - ERR("failed to fill audio into frame\n"); + LOG_SEVERE("failed to fill audio into frame\n"); } else { resample_sample_fmt = convert_audio_sample_fmt(avctx->codec, avctx->codec_type, 1); @@ -1515,7 +1515,7 @@ static bool encode_audio(MaruBrillCodecState *s, int ctx_id, void *data_buf) if (resample_frame) { len = avcodec_encode_audio2(avctx, avpkt, (const AVFrame *)resample_frame, &got_frame); - TRACE("encode audio. len %d got_frame %d avpkt->size %d frame_number %d\n", + LOG_TRACE("encode audio. len %d got_frame %d avpkt->size %d frame_number %d\n", len, got_frame, avpkt->size, avctx->frame_number); } } @@ -1527,7 +1527,7 @@ static bool encode_audio(MaruBrillCodecState *s, int ctx_id, void *data_buf) brillcodec_push_writequeue(s, dc, 0, ctx_id, ©_audio_encode_data); - TRACE("[%s] leave:\n", __func__); + LOG_TRACE("[%s] leave:\n", __func__); return true; } @@ -1568,7 +1568,7 @@ static void serialize_video_data(const struct video_data *video, avctx->ticks_per_frame = video->ticks_per_frame; } - INFO("codec_init. video, resolution: %dx%d, framerate: %d/%d " + LOG_INFO("codec_init. video, resolution: %dx%d, framerate: %d/%d " "pixel_fmt: %d sample_aspect_ratio: %d/%d bpp %d\n", avctx->width, avctx->height, avctx->time_base.num, avctx->time_base.den, avctx->pix_fmt, avctx->sample_aspect_ratio.num, @@ -1592,7 +1592,7 @@ static void serialize_audio_data(const struct audio_data *audio, avctx->sample_fmt = audio->sample_fmt; } - INFO("codec_init. audio, channel %d sample_rate %d sample_fmt %d ch_layout %lld\n", + LOG_INFO("codec_init. audio, channel %d sample_rate %d sample_fmt %d ch_layout %lld\n", avctx->channels, avctx->sample_rate, avctx->sample_fmt, avctx->channel_layout); } @@ -1639,12 +1639,12 @@ static enum PixelFormat get_format(AVCodecContext *avctx, goto end; } - INFO("HW_ACCEL is enabled with pix_fmt [%s]\n", av_get_pix_fmt_name(pi_fmt[i])); + LOG_INFO("HW_ACCEL is enabled with pix_fmt [%s]\n", av_get_pix_fmt_name(pi_fmt[i])); context->is_hwaccel = true; return pi_fmt[i]; end: - INFO("HW_ACCEL is disabled\n"); + LOG_INFO("HW_ACCEL is disabled\n"); context->is_hwaccel = false; return avcodec_default_get_format(avctx, pi_fmt); } @@ -1684,9 +1684,9 @@ static void release_buffer(struct AVCodecContext *avctx, AVFrame *frame) // allocate avcontext and avframe struct. static AVCodecContext *maru_brill_codec_alloc_context(MaruBrillCodecState *s, int ctx_id) { - TRACE("enter: %s\n", __func__); + LOG_TRACE("enter: %s\n", __func__); - TRACE("allocate %d of context and frame.\n", ctx_id); + LOG_TRACE("allocate %d of context and frame.\n", ctx_id); CONTEXT(s, ctx_id)->avctx = avcodec_alloc_context3(NULL); @@ -1710,7 +1710,7 @@ static AVCodecContext *maru_brill_codec_alloc_context(MaruBrillCodecState *s, in CONTEXT(s, ctx_id)->opened_context = false; CONTEXT(s, ctx_id)->state = s; - TRACE("leave: %s\n", __func__); + LOG_TRACE("leave: %s\n", __func__); return avctx; } @@ -1726,14 +1726,14 @@ static AVCodec *maru_brill_codec_find_avcodec(uint8_t *mem_buf) memcpy(codec_name, mem_buf + size, sizeof(codec_name)); size += sizeof(codec_name); - TRACE("type: %d, name: %s\n", encode, codec_name); + LOG_TRACE("type: %d, name: %s\n", encode, codec_name); if (encode) { codec = avcodec_find_encoder_by_name (codec_name); } else { codec = avcodec_find_decoder_by_name (codec_name); } - INFO("%s!! find %s %s\n", codec ? "success" : "failure", + LOG_INFO("%s!! find %s %s\n", codec ? "success" : "failure", codec_name, encode ? "encoder" : "decoder"); return codec; @@ -1764,7 +1764,7 @@ static void read_codec_init_data(AVCodecContext *avctx, uint8_t *mem_buf) memcpy(&avctx->extradata_size, mem_buf + size, sizeof(avctx->extradata_size)); size += sizeof(avctx->extradata_size); - INFO("extradata size: %d.\n", avctx->extradata_size); + LOG_INFO("extradata size: %d.\n", avctx->extradata_size); if (avctx->extradata_size > 0) { avctx->extradata = @@ -1774,7 +1774,7 @@ static void read_codec_init_data(AVCodecContext *avctx, uint8_t *mem_buf) memcpy(avctx->extradata, mem_buf + size, avctx->extradata_size); } } else { - TRACE("no extra data.\n"); + LOG_TRACE("no extra data.\n"); avctx->extradata = av_mallocz(ROUND_UP_X(FF_INPUT_BUFFER_PADDING_SIZE, 4)); } @@ -1788,7 +1788,7 @@ static int write_codec_init_data(AVCodecContext *avctx, uint8_t *mem_buf) if (avctx->codec->type == AVMEDIA_TYPE_AUDIO) { int osize = av_get_bytes_per_sample(avctx->sample_fmt); - INFO("avcodec_open. sample_fmt %d, bytes_per_sample %d\n", avctx->sample_fmt, osize); + LOG_INFO("avcodec_open. sample_fmt %d, bytes_per_sample %d\n", avctx->sample_fmt, osize); if ((avctx->codec_id == AV_CODEC_ID_AAC) && avctx->codec->encode2) { osize = av_get_bytes_per_sample(AV_SAMPLE_FMT_S16); @@ -1812,25 +1812,25 @@ static AVCodecParserContext *maru_brill_codec_parser_init(AVCodecContext *avctx) AVCodecParserContext *parser = NULL; if (!avctx) { - ERR("context is NULL\n"); + LOG_SEVERE("context is NULL\n"); return NULL; } switch (avctx->codec_id) { case AV_CODEC_ID_MPEG4: case AV_CODEC_ID_VC1: - TRACE("not using parser\n"); + LOG_TRACE("not using parser\n"); break; case AV_CODEC_ID_H264: if (avctx->extradata_size == 0) { - TRACE("H.264 with no extradata, creating parser.\n"); + LOG_TRACE("H.264 with no extradata, creating parser.\n"); parser = av_parser_init (avctx->codec_id); } break; default: parser = av_parser_init(avctx->codec_id); if (parser) { - INFO("using parser: %s\n", avctx->codec->name); + LOG_INFO("using parser: %s\n", avctx->codec->name); } break; } @@ -1847,7 +1847,7 @@ static bool init(MaruBrillCodecState *s, int ctx_id, void *data_buf) uint8_t *tempbuf = NULL; int tempbuf_size = 0; - TRACE("enter: %s\n", __func__); + LOG_TRACE("enter: %s\n", __func__); elem = (DeviceMemEntry *)data_buf; @@ -1857,7 +1857,7 @@ static bool init(MaruBrillCodecState *s, int ctx_id, void *data_buf) // allocate AVCodecContext avctx = maru_brill_codec_alloc_context(s, ctx_id); if (!avctx) { - ERR("[%d] failed to allocate context.\n", __LINE__); + LOG_SEVERE("[%d] failed to allocate context.\n", __LINE__); ret = -1; } else { codec = maru_brill_codec_find_avcodec(elem->opaque); @@ -1867,22 +1867,21 @@ static bool init(MaruBrillCodecState *s, int ctx_id, void *data_buf) // in case of aac encoder, sample format is float if (!strcmp(codec->name, "aac") && codec->encode2) { - TRACE("convert sample format into SAMPLE_FMT_FLTP\n"); + LOG_TRACE("convert sample format into SAMPLE_FMT_FLTP\n"); avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; avctx->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL; - INFO("aac encoder!! channels %d channel_layout %lld\n", avctx->channels, avctx->channel_layout); + LOG_INFO("aac encoder!! channels %d channel_layout %lld\n", avctx->channels, avctx->channel_layout); avctx->channel_layout = av_get_default_channel_layout(avctx->channels); } - TRACE("audio sample format %d\n", avctx->sample_fmt); - TRACE("strict_std_compliance %d\n", avctx->strict_std_compliance); + LOG_TRACE("audio sample format %d\n", avctx->sample_fmt); + LOG_TRACE("strict_std_compliance %d\n", avctx->strict_std_compliance); ret = avcodec_open2(avctx, codec, NULL); - INFO("avcodec_open. ret 0x%x ctx_id %d\n", ret, ctx_id); - - INFO("channels %d sample_rate %d sample_fmt %d " + LOG_INFO("avcodec_open. ret 0x%x ctx_id %d\n", ret, ctx_id); + LOG_INFO("channels %d sample_rate %d sample_fmt %d " "channel_layout %lld frame_size %d\n", avctx->channels, avctx->sample_rate, avctx->sample_fmt, avctx->channel_layout, avctx->frame_size); @@ -1895,7 +1894,7 @@ static bool init(MaruBrillCodecState *s, int ctx_id, void *data_buf) CONTEXT(s, ctx_id)->parser_ctx = maru_brill_codec_parser_init(avctx); } else { - ERR("failed to find codec. ctx_id: %d\n", ctx_id); + LOG_SEVERE("failed to find codec. ctx_id: %d\n", ctx_id); ret = -1; } } @@ -1904,21 +1903,21 @@ static bool init(MaruBrillCodecState *s, int ctx_id, void *data_buf) tempbuf = g_malloc(tempbuf_size); if (!tempbuf) { - ERR("failed to allocate a buffer\n"); + LOG_SEVERE("failed to allocate a buffer\n"); tempbuf_size = 0; } else { memcpy(tempbuf, &ret, sizeof(ret)); size = sizeof(ret); if (ret < 0) { - ERR("failed to open codec contex.\n"); + LOG_SEVERE("failed to open codec contex.\n"); } else { size += write_codec_init_data(avctx, tempbuf + size); - TRACE("codec_init. copyback!! size %d\n", size); + LOG_TRACE("codec_init. copyback!! size %d\n", size); { memcpy(tempbuf + size, &avctx->extradata_size, sizeof(avctx->extradata_size)); size += sizeof(avctx->extradata_size); - INFO("codec_init. extradata_size: %d\n", avctx->extradata_size); + LOG_INFO("codec_init. extradata_size: %d\n", avctx->extradata_size); if (avctx->extradata) { memcpy(tempbuf + size, avctx->extradata, avctx->extradata_size); size += avctx->extradata_size; @@ -1929,7 +1928,7 @@ static bool init(MaruBrillCodecState *s, int ctx_id, void *data_buf) brillcodec_push_writequeue(s, tempbuf, tempbuf_size, ctx_id, NULL); - TRACE("leave: %s\n", __func__); + LOG_TRACE("leave: %s\n", __func__); return true; } @@ -1940,18 +1939,18 @@ static bool deinit(MaruBrillCodecState *s, int ctx_id, void *data_buf) AVFrame *frame = NULL; AVCodecParserContext *parserctx = NULL; - TRACE("enter: %s\n", __func__); + LOG_TRACE("enter: %s\n", __func__); avctx = CONTEXT(s, ctx_id)->avctx; frame = CONTEXT(s, ctx_id)->frame; parserctx = CONTEXT(s, ctx_id)->parser_ctx; if (!avctx || !frame) { - TRACE("%d of AVCodecContext or AVFrame is NULL. " + LOG_TRACE("%d of AVCodecContext or AVFrame is NULL. " " Those resources have been released before.\n", ctx_id); return false; } - INFO("close avcontext of %d\n", ctx_id); + LOG_INFO("close avcontext of %d\n", ctx_id); avcodec_close(avctx); if (CONTEXT(s, ctx_id)->is_hwaccel) { @@ -1960,12 +1959,12 @@ static bool deinit(MaruBrillCodecState *s, int ctx_id, void *data_buf) } if (avctx->extradata) { - TRACE("free context extradata\n"); + LOG_TRACE("free context extradata\n"); av_free(avctx->extradata); } if (frame) { - TRACE("free frame\n"); + LOG_TRACE("free frame\n"); #if LIBAVUTIL_VERSION_CHECK avcodec_free_frame(&frame); #else @@ -1974,12 +1973,12 @@ static bool deinit(MaruBrillCodecState *s, int ctx_id, void *data_buf) } if (avctx) { - TRACE("free codec context\n"); + LOG_TRACE("free codec context\n"); av_free(avctx); } if (parserctx) { - INFO("close parser context\n"); + LOG_INFO("close parser context\n"); av_parser_close(parserctx); } @@ -1990,7 +1989,7 @@ static bool deinit(MaruBrillCodecState *s, int ctx_id, void *data_buf) // reset profile resource RESET_CODEC_PROFILE(); - TRACE("leave: %s\n", __func__); + LOG_TRACE("leave: %s\n", __func__); return true; } diff --git a/tizen/src/hw/pci/maru_brillcodec_device.c b/tizen/src/hw/pci/maru_brillcodec_device.c index 15e0287..bdc13cf 100644 --- a/tizen/src/hw/pci/maru_brillcodec_device.c +++ b/tizen/src/hw/pci/maru_brillcodec_device.c @@ -37,10 +37,10 @@ #include "hw/maru_device_ids.h" #include "util/osutil.h" #include "maru_brillcodec.h" -#include "debug_ch.h" +#include "util/new_debug_ch.h" /* define debug channel */ -MULTI_DEBUG_CHANNEL(qemu, brillcodec); +DECLARE_DEBUG_CHANNEL(brillcodec); #define CODEC_DEVICE_NAME "codec-pci" #define CODEC_DEVICE_THREAD "codec-workthread" @@ -61,7 +61,7 @@ enum device_cmd { DEVICE_CMD_RELEASE_CONTEXT, DEVICE_CMD_GET_ELEMENT, DEVICE_CMD_GET_CONTEXT_INDEX, - DEVICE_CMD_GET_DEVICE_INFO, + DEVICE_CMD_GET_DEVICE_LOG_INFO, DEVICE_CMD_GET_PROFILE_STATUS, }; @@ -75,11 +75,11 @@ static void brillcodec_threads_create(MaruBrillCodecState *s) int index; QemuThread *pthread = NULL; - TRACE("enter: %s\n", __func__); + LOG_TRACE("enter: %s\n", __func__); pthread = g_malloc(sizeof(QemuThread) * s->worker_thread_cnt); if (!pthread) { - ERR("failed to allocate threadpool memory.\n"); + LOG_SEVERE("failed to allocate threadpool memory.\n"); return; } @@ -99,7 +99,7 @@ static void brillcodec_threads_create(MaruBrillCodecState *s) s->threadpool.threads = pthread; - TRACE("leave: %s\n", __func__); + LOG_TRACE("leave: %s\n", __func__); } static void brillcodec_get_cpu_cores(MaruBrillCodecState *s) @@ -109,28 +109,28 @@ static void brillcodec_get_cpu_cores(MaruBrillCodecState *s) s->worker_thread_cnt = DEFAULT_WORKER_THREAD_CNT; } - TRACE("number of threads: %d\n", s->worker_thread_cnt); + LOG_TRACE("number of threads: %d\n", s->worker_thread_cnt); } static void brillcodec_bh_callback(void *opaque) { MaruBrillCodecState *s = (MaruBrillCodecState *)opaque; - TRACE("enter: %s\n", __func__); + LOG_TRACE("enter: %s\n", __func__); qemu_mutex_lock(&s->context_queue_mutex); if (!QTAILQ_EMPTY(&codec_wq)) { qemu_mutex_unlock(&s->context_queue_mutex); - TRACE("raise irq\n"); + LOG_TRACE("raise irq\n"); pci_set_irq(&s->dev, 1); s->irq_raised = 1; } else { qemu_mutex_unlock(&s->context_queue_mutex); - TRACE("codec_wq is empty!!\n"); + LOG_TRACE("codec_wq is empty!!\n"); } - TRACE("leave: %s\n", __func__); + LOG_TRACE("leave: %s\n", __func__); } static uint64_t brillcodec_read(void *opaque, @@ -150,7 +150,7 @@ static uint64_t brillcodec_read(void *opaque, } qemu_mutex_unlock(&s->context_queue_mutex); - TRACE("get thread_state. ret: %d\n", ret); + LOG_TRACE("get thread_state. ret: %d\n", ret); break; case DEVICE_CMD_GET_CTX_FROM_QUEUE: @@ -163,20 +163,20 @@ static uint64_t brillcodec_read(void *opaque, ret = head->ctx_id; QTAILQ_REMOVE(&codec_wq, head, node); entry[ret] = head; - TRACE("get a elem from codec_wq. 0x%x\n", head); + LOG_TRACE("get a elem from codec_wq. 0x%x\n", head); } else { ret = 0; } qemu_mutex_unlock(&s->context_queue_mutex); - TRACE("get a head from a writequeue. head: %x\n", ret); + LOG_TRACE("get a head from a writequeue. head: %x\n", ret); } break; - case DEVICE_CMD_GET_DEVICE_INFO: + case DEVICE_CMD_GET_DEVICE_LOG_INFO: ret |= CODEC_MAJOR_VERSION << 8; ret |= CODEC_MINOR_VERSION; - TRACE("codec version: %d.%d.%d\n", CODEC_MAJOR_VERSION, CODEC_MINOR_VERSION, 0); + LOG_TRACE("codec version: %d.%d.%d\n", CODEC_MAJOR_VERSION, CODEC_MINOR_VERSION, 0); ret |= s->memory_monopolizing << 16; break; @@ -187,16 +187,16 @@ static uint64_t brillcodec_read(void *opaque, case DEVICE_CMD_GET_CONTEXT_INDEX: ret = brillcodec_get_context_index(s); - TRACE("get context index: %d\n", ret); + LOG_TRACE("get context index: %d\n", ret); break; case DEVICE_CMD_GET_PROFILE_STATUS: ret = s->profile; - TRACE("profile status: %d\n", s->profile); + LOG_TRACE("profile status: %d\n", s->profile); break; default: - ERR("no avaiable command for read. %d\n", addr); + LOG_SEVERE("no avaiable command for read. %d\n", addr); } return ret; @@ -209,18 +209,18 @@ static void brillcodec_write(void *opaque, hwaddr addr, switch (addr >> 2) { case DEVICE_CMD_API_INDEX: - TRACE("set codec_cmd value: %d\n", value); + LOG_TRACE("set codec_cmd value: %d\n", value); s->ioparam.api_index = value; brillcodec_wakeup_threads(s, value); break; case DEVICE_CMD_CONTEXT_INDEX: - TRACE("set context_index value: %d\n", value); + LOG_TRACE("set context_index value: %d\n", value); s->ioparam.ctx_index = value; break; case DEVICE_CMD_DEVICE_MEM_OFFSET: - TRACE("set mem_offset value: 0x%x\n", value); + LOG_TRACE("set mem_offset value: 0x%x\n", value); s->ioparam.mem_offset = value; break; @@ -230,7 +230,7 @@ static void brillcodec_write(void *opaque, hwaddr addr, if (CONTEXT(s, ctx_id)->occupied_thread) { CONTEXT(s, ctx_id)->requested_close = true; - INFO("make running thread to handle deinit\n"); + LOG_INFO("make running thread to handle deinit\n"); } else { brillcodec_release_context(s, ctx_id); } @@ -242,7 +242,7 @@ static void brillcodec_write(void *opaque, hwaddr addr, break; default: - ERR("no available command for write. %d\n", addr); + LOG_SEVERE("no available command for write. %d\n", addr); } } @@ -262,8 +262,8 @@ static int brillcodec_initfn(PCIDevice *dev) MaruBrillCodecState *s = DO_UPCAST(MaruBrillCodecState, dev, dev); uint8_t *pci_conf = s->dev.config; - INFO("device initialization.\n"); - INFO("version: %d.%d.%d\n", CODEC_MAJOR_VERSION, CODEC_MINOR_VERSION, 0); + LOG_INFO("device initialization.\n"); + LOG_INFO("version: %d.%d.%d\n", CODEC_MAJOR_VERSION, CODEC_MINOR_VERSION, 0); pci_config_set_interrupt_pin(pci_conf, 1); @@ -288,7 +288,7 @@ static int brillcodec_initfn(PCIDevice *dev) // register plugins if ((s->hwaccel_plugin = probe_plugin())) { - INFO("%s extension is enabled.\n", s->hwaccel_plugin->name); + LOG_INFO("%s extension is enabled.\n", s->hwaccel_plugin->name); } // configurations @@ -296,12 +296,12 @@ static int brillcodec_initfn(PCIDevice *dev) #ifdef SUPPORT_MEMORY_MONOPOLIZING # ifdef ENCODE_VIDEO_USE_MEMORY_MONOPOLIZING s->memory_monopolizing |= 1 << ENCODE_VIDEO; - INFO("API [%d] use memory monopolizing.\n", ENCODE_VIDEO); + LOG_INFO("API [%d] use memory monopolizing.\n", ENCODE_VIDEO); # endif #endif if (s->profile) { - INFO("Profile the brillcodec.(%d)\n", s->profile); + LOG_INFO("Profile the brillcodec.(%d)\n", s->profile); } return 0; @@ -310,7 +310,7 @@ static int brillcodec_initfn(PCIDevice *dev) static void brillcodec_exitfn(PCIDevice *dev) { MaruBrillCodecState *s = DO_UPCAST(MaruBrillCodecState, dev, dev); - INFO("device exit\n"); + LOG_INFO("device exit\n"); qemu_mutex_destroy(&s->context_mutex); qemu_mutex_destroy(&s->context_queue_mutex); @@ -325,7 +325,7 @@ static void brillcodec_exitfn(PCIDevice *dev) static void brillcodec_reset(DeviceState *d) { MaruBrillCodecState *s = (MaruBrillCodecState *)d; - INFO("device reset\n"); + LOG_INFO("device reset\n"); s->irq_raised = 0; diff --git a/tizen/src/hw/pci/maru_brillcodec_vaapi.c b/tizen/src/hw/pci/maru_brillcodec_vaapi.c index 460982b..cfb7fb9 100644 --- a/tizen/src/hw/pci/maru_brillcodec_vaapi.c +++ b/tizen/src/hw/pci/maru_brillcodec_vaapi.c @@ -46,10 +46,10 @@ #define DEFAULT_SURFACE_COUNT 4 -#include "debug_ch.h" +#include "util/new_debug_ch.h" /* define debug channel */ -MULTI_DEBUG_CHANNEL(qemu, vaapi); +DECLARE_DEBUG_CHANNEL(vaapi); struct SurfaceState; typedef struct SurfaceState SurfaceState; @@ -132,21 +132,21 @@ static bool initialize(void) Display *display = XOpenDisplay(NULL); if (!display) { - ERR("Could not connect to x server\n"); + LOG_SEVERE("Could not connect to x server\n"); return false; } va_display = _vaGetDisplay(display); if (!va_display) { - ERR("Could not get a VAAPI device\n"); + LOG_SEVERE("Could not get a VAAPI device\n"); return false; } if (_vaInitialize(va_display, &va_major_version, &va_minor_version)) { va_display = NULL; - ERR("Failed to initialize the VAAPI device\n"); + LOG_SEVERE("Failed to initialize the VAAPI device\n"); return false; } } @@ -197,14 +197,14 @@ static bool probe(void) // we initialize vaapi now for sure... if (!initialize()) { - ERR("Can not initialize VA-API\n"); + LOG_SEVERE("Can not initialize VA-API\n"); return false; } return true; error: - ERR("plugin load failed : %s\n", dlerror()); + LOG_SEVERE("plugin load failed : %s\n", dlerror()); return false; } @@ -253,13 +253,13 @@ static int create_surfaces(VAPluginContext *va_ctx, goto error; } #else - ERR("Can not run with VA-API version (%d, %d)\n", va_major_version, va_minor_version); + LOG_SEVERE("Can not run with VA-API version (%d, %d)\n", va_major_version, va_minor_version); goto error; #endif } else { if (((_vaCreateSurfaces6)_vaCreateSurfaces)(va_ctx->display, width, height, VA_RT_FORMAT_YUV420, va_ctx->surface_count, va_ctx->surface_id)) { - ERR("Can not run with VA-API version (%d, %d)\n", va_major_version, va_minor_version); + LOG_SEVERE("Can not run with VA-API version (%d, %d)\n", va_major_version, va_minor_version); goto error; } } @@ -386,13 +386,13 @@ static void *setup(AVCodecContext *ctx, int width, int height) g_free(profiles_list); if (!is_supported_profile) { - ERR("Codec and profile not supported by the VAAPI device"); + LOG_SEVERE("Codec and profile not supported by the VAAPI device"); goto error; } if (create_surfaces(va_ctx, width, height, profile)) { - ERR("Failed to initialize the VAAPI device\n"); + LOG_SEVERE("Failed to initialize the VAAPI device\n"); goto error; } @@ -553,7 +553,7 @@ static int get_surface(AVCodecContext *ctx, #else frame->buf[0] = av_buffer_create(frame->data[0], 0, release_surface, frame->opaque, 0); if (!frame->buf[0]) { - ERR("failed to create AVBufferRef\n"); + LOG_SEVERE("failed to create AVBufferRef\n"); } #endif diff --git a/tizen/src/hw/pci/maru_dxva2_plugin.c b/tizen/src/hw/pci/maru_dxva2_plugin.c index 3c38369..0ea8417 100644 --- a/tizen/src/hw/pci/maru_dxva2_plugin.c +++ b/tizen/src/hw/pci/maru_dxva2_plugin.c @@ -27,18 +27,6 @@ * */ -#if 0 -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x600 -#else -# if _WIN32_WINNT < 0x600 -/* dxva2 needs Vista support */ -# undef _WIN32_WINNT -# define _WIN32_WINNT 0x600 -# endif -#endif -#endif - #define DXVA2API_USE_BITFIELDS #define COBJMACROS @@ -81,10 +69,10 @@ #endif /* __MINGW32__ */ #include "maru_brillcodec_plugin.h" -#include "debug_ch.h" +#include "util/new_debug_ch.h" /* define debug channel */ -MULTI_DEBUG_CHANNEL(qemu, dxva2); +DECLARE_DEBUG_CHANNEL(dxva2); MS_GUID(IID_IDirectXVideoDecoderService, 0xfc51a551, 0xd5e7, 0x11d9, 0xaf,0x55,0x00,0x05,0x4e,0x43,0xff,0x02); @@ -292,7 +280,7 @@ static int D3dCreateDevice(void) LPDIRECT3D9 (WINAPI *Create9)(UINT SDKVersion); Create9 = (void *)GetProcAddress(dxva_dev->hd3d9_dll, "Direct3DCreate9"); if (!Create9) { - ERR("Cannot locate reference to Direct3DCreate9 ABI in DLL\n"); + LOG_SEVERE("Cannot locate reference to Direct3DCreate9 ABI in DLL\n"); return -1; } @@ -300,7 +288,7 @@ static int D3dCreateDevice(void) LPDIRECT3D9 d3dobj; d3dobj = Create9(D3D_SDK_VERSION); if (!d3dobj) { - ERR("Direct3DCreate9 failed\n"); + LOG_SEVERE("Direct3DCreate9 failed\n"); return -1; } dxva_dev->d3dobj = d3dobj; @@ -329,7 +317,7 @@ static int D3dCreateDevice(void) D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_MULTITHREADED, &d3dpp, &d3ddev))) { - ERR("IDirect3D9_CreateDevice failed\n"); + LOG_SEVERE("IDirect3D9_CreateDevice failed\n"); return -1; } dxva_dev->d3ddev = d3ddev; @@ -349,24 +337,24 @@ static int D3dCreateDeviceManager(void) "DXVA2CreateDirect3DDeviceManager9"); if (!CreateDeviceManager9) { - ERR("cannot load function\n"); + LOG_SEVERE("cannot load function\n"); return -1; } UINT token; IDirect3DDeviceManager9 *devmng; if (FAILED(CreateDeviceManager9(&token, &devmng))) { - ERR("OurDirect3DCreateDeviceManager9 failed\n"); + LOG_SEVERE("OurDirect3DCreateDeviceManager9 failed\n"); return -1; } - TRACE("OurDirect3DCreateDeviceManager9 Success!\n"); + LOG_TRACE("OurDirect3DCreateDeviceManager9 Success!\n"); dxva_dev->devmng = devmng; - TRACE("obtained IDirect3DDeviceManager9\n"); + LOG_TRACE("obtained IDirect3DDeviceManager9\n"); HRESULT hr = IDirect3DDeviceManager9_ResetDevice(devmng, dxva_dev->d3ddev, token); if (FAILED(hr)) { - ERR("IDirect3DDeviceManager9_ResetDevice failed: %08x\n", (unsigned)hr); + LOG_SEVERE("IDirect3DDeviceManager9_ResetDevice failed: %08x\n", (unsigned)hr); return -1; } @@ -385,17 +373,17 @@ static int DxCreateVideoService(void) (void *)GetProcAddress(dxva_dev->hdxva2_dll, "DXVA2CreateVideoService"); if (!CreateVideoService) { - ERR("cannot load function\n"); + LOG_SEVERE("cannot load function\n"); return -1; } - TRACE("DXVA2CreateVideoService Success!\n"); + LOG_TRACE("DXVA2CreateVideoService Success!\n"); HRESULT hr; HANDLE hd3ddev; hr = IDirect3DDeviceManager9_OpenDeviceHandle(dxva_dev->devmng, &hd3ddev); if (FAILED(hr)) { - ERR("OpenDeviceHandle failed\n"); + LOG_SEVERE("OpenDeviceHandle failed\n"); return -1; } dxva_dev->hd3ddev = hd3ddev; @@ -404,7 +392,7 @@ static int DxCreateVideoService(void) hr = IDirect3DDeviceManager9_GetVideoService(dxva_dev->devmng, hd3ddev, &IID_IDirectXVideoDecoderService, &pv); if (FAILED(hr)) { - ERR("GetVideoService failed\n"); + LOG_SEVERE("GetVideoService failed\n"); return -1; } dxva_dev->vs = pv; @@ -427,17 +415,17 @@ static int DxFindVideoServiceConversion(DXVAPluginContext *dxva_ctx, int codec_i if (FAILED(IDirectXVideoDecoderService_GetDecoderDeviceGuids(dxva_dev->vs, &decdev_count, &guid_decdev_list))) { - ERR("IDirectXVideoDecoderService_GetDecoderDeviceGuids failed\n"); + LOG_SEVERE("IDirectXVideoDecoderService_GetDecoderDeviceGuids failed\n"); return -1; } - INFO("IDirectXVideoDecoderService_GetDecoderDeviceGuids success. count=%d\n", decdev_count); + LOG_INFO("IDirectXVideoDecoderService_GetDecoderDeviceGuids success. count=%d\n", decdev_count); for (i = 0; i < decdev_count; i++) { const GUID *g = &guid_decdev_list[i]; const dxva2_mode_t *mode = Dxva2FindMode(g); if (mode) { - INFO("- '%s' is supported by hardware\n", mode->name); + LOG_INFO("- '%s' is supported by hardware\n", mode->name); } else { WARN("- Unknown GUID = %08X-%04x-%04x-XXXX\n", (unsigned)g->Data1, g->Data2, g->Data3); @@ -461,24 +449,24 @@ static int DxFindVideoServiceConversion(DXVAPluginContext *dxva_ctx, int codec_i continue; /* */ - INFO("Trying to use '%s' as input\n", mode->name); + LOG_INFO("Trying to use '%s' as input\n", mode->name); UINT render_fmt_count = 0; D3DFORMAT *render_fmt_list = NULL; if (FAILED(IDirectXVideoDecoderService_GetDecoderRenderTargets(dxva_dev->vs, mode->guid, &render_fmt_count, &render_fmt_list))) { - ERR("IDirectXVideoDecoderService_GetDecoderRenderTargets failed\n"); + LOG_SEVERE("IDirectXVideoDecoderService_GetDecoderRenderTargets failed\n"); continue; } for (j = 0; j < render_fmt_count; j++) { const D3DFORMAT f = render_fmt_list[j]; const d3d_format_t *format = D3dFindFormat(f); - INFO("HOST supported format %d (%4.4s)\n", f, (const char*)&f); + LOG_INFO("HOST supported format %d (%4.4s)\n", f, (const char*)&f); if (format) { - INFO("%s is supported for output\n", format->name); + LOG_INFO("%s is supported for output\n", format->name); } else { - INFO("%d is supported for output (%4.4s)\n", f, (const char*)&f); + LOG_INFO("%d is supported for output (%4.4s)\n", f, (const char*)&f); } } @@ -496,7 +484,7 @@ static int DxFindVideoServiceConversion(DXVAPluginContext *dxva_ctx, int codec_i continue; /* We have our solution */ - INFO("Using '%s' to decode to '%s'\n", mode->name, format->name); + LOG_INFO("Using '%s' to decode to '%s'\n", mode->name, format->name); *guid_decdev = *mode->guid; *render_fmt = format->format; CoTaskMemFree(render_fmt_list); @@ -540,7 +528,7 @@ static int DxCreateVideoDecoder(DXVAPluginContext *dxva_ctx, AVCodecContext *dec codec_id = dec_ctx->codec_id; - TRACE("DxCreateVideoDecoder id %d %dx%d\n", + LOG_TRACE("DxCreateVideoDecoder id %d %dx%d\n", codec_id, width, height); /* Allocates all surfaces needed for the decoder */ @@ -571,7 +559,7 @@ static int DxCreateVideoDecoder(DXVAPluginContext *dxva_ctx, AVCodecContext *dec DXVA2_VideoDecoderRenderTarget, dxva_ctx->hw_surface, NULL))) { - ERR("IDirectXVideoAccelerationService_CreateSurface failed\n"); + LOG_SEVERE("IDirectXVideoAccelerationService_CreateSurface failed\n"); dxva_ctx->surface_count = 0; return -1; } @@ -582,7 +570,7 @@ static int DxCreateVideoDecoder(DXVAPluginContext *dxva_ctx, AVCodecContext *dec dxva_ctx->surface[i].is_occupied = false; dxva_ctx->surface[i].dxva_ctx = dxva_ctx; } - TRACE("IDirectXVideoAccelerationService_CreateSurface succeed with %d surfaces (%dx%d)\n", + LOG_TRACE("IDirectXVideoAccelerationService_CreateSurface succeed with %d surfaces (%dx%d)\n", dxva_ctx->surface_count, width, height); /* */ @@ -616,10 +604,10 @@ static int DxCreateVideoDecoder(DXVAPluginContext *dxva_ctx, AVCodecContext *dec NULL, &cfg_count, &cfg_list))) { - ERR("IDirectXVideoDecoderService_GetDecoderConfigurations failed\n"); + LOG_SEVERE("IDirectXVideoDecoderService_GetDecoderConfigurations failed\n"); return -1; } - TRACE("we got %d decoder configurations\n", cfg_count); + LOG_TRACE("we got %d decoder configurations\n", cfg_count); /* Select the best decoder configuration */ int cfg_score = 0; @@ -627,7 +615,7 @@ static int DxCreateVideoDecoder(DXVAPluginContext *dxva_ctx, AVCodecContext *dec const DXVA2_ConfigPictureDecode *cfg = &cfg_list[i]; /* */ - TRACE("configuration[%d] ConfigBitstreamRaw %d\n", + LOG_TRACE("configuration[%d] ConfigBitstreamRaw %d\n", i, cfg->ConfigBitstreamRaw); /* */ @@ -648,7 +636,7 @@ static int DxCreateVideoDecoder(DXVAPluginContext *dxva_ctx, AVCodecContext *dec } CoTaskMemFree(cfg_list); if (cfg_score <= 0) { - ERR("Failed to find a supported decoder configuration\n"); + LOG_SEVERE("Failed to find a supported decoder configuration\n"); return -1; } @@ -661,11 +649,11 @@ static int DxCreateVideoDecoder(DXVAPluginContext *dxva_ctx, AVCodecContext *dec dxva_ctx->hw_surface, dxva_ctx->surface_count, &decoder))) { - ERR("IDirectXVideoDecoderService_CreateVideoDecoder failed\n"); + LOG_SEVERE("IDirectXVideoDecoderService_CreateVideoDecoder failed\n"); return -1; } dxva_ctx->decoder = decoder; - TRACE("IDirectXVideoDecoderService_CreateVideoDecoder succeed\n"); + LOG_TRACE("IDirectXVideoDecoderService_CreateVideoDecoder succeed\n"); return 0; } @@ -718,7 +706,7 @@ static void D3dDestroyDevice(void) #if 0 static int DxResetVideoDecoder(void) { - ERR("DxResetVideoDecoder unimplemented\n"); + LOG_SEVERE("DxResetVideoDecoder unimplemented\n"); return -1; } #endif @@ -802,29 +790,29 @@ static bool probe(void) if (dxva_dev->hd3d9_dll == NULL || dxva_dev->hdxva2_dll == NULL) { dxva_dev->hd3d9_dll = LoadLibrary(TEXT("D3D9.DLL")); if (!dxva_dev->hd3d9_dll) { - ERR("cannot load d3d9.dll\n"); + LOG_SEVERE("cannot load d3d9.dll\n"); goto error; } dxva_dev->hdxva2_dll = LoadLibrary(TEXT("DXVA2.DLL")); if (!dxva_dev->hdxva2_dll) { - ERR("cannot load dxva2.dll\n"); + LOG_SEVERE("cannot load dxva2.dll\n"); goto error; } - TRACE("DLLs loaded\n"); + LOG_TRACE("DLLs loaded\n"); if (D3dCreateDevice() < 0) { - ERR("Failed to create Direct3D device\n"); + LOG_SEVERE("Failed to create Direct3D device\n"); goto error; } - TRACE("D3dCreateDevice succeed\n"); + LOG_TRACE("D3dCreateDevice succeed\n"); if (D3dCreateDeviceManager() < 0) { - ERR("D3dCreateDeviceManager failed\n"); + LOG_SEVERE("D3dCreateDeviceManager failed\n"); goto error; } if (DxCreateVideoService() < 0) { - ERR("DxCreateVideoService failed\n"); + LOG_SEVERE("DxCreateVideoService failed\n"); goto error; } } @@ -855,14 +843,14 @@ static void *dxva_setup(AVCodecContext *dec_ctx, int width, int height) DXVAPluginContext *dxva_ctx = g_malloc0(sizeof(DXVAPluginContext)); if (DxFindVideoServiceConversion(dxva_ctx, dec_ctx->codec_id)) { - ERR("DxFindVideoServiceConversion failed\n"); + LOG_SEVERE("DxFindVideoServiceConversion failed\n"); return NULL; } dxva_ctx->thread_count = dec_ctx->thread_count; if (DxCreateVideoDecoder(dxva_ctx, dec_ctx) < -1) { - ERR("DxCreateVideoDecoder failed\n"); + LOG_SEVERE("DxCreateVideoDecoder failed\n"); return NULL; } @@ -915,7 +903,7 @@ static int dxva_get_surface(AVCodecContext *dec_ctx, AVFrame *frame) if (DxResetVideoDecoder()) return -1; } else if (FAILED(hr)) { - ERR("IDirect3DDeviceManager9_TestDevice %u\n", (unsigned)hr); + LOG_SEVERE("IDirect3DDeviceManager9_TestDevice %u\n", (unsigned)hr); return -1; } #endif @@ -939,7 +927,7 @@ static int dxva_get_surface(AVCodecContext *dec_ctx, AVFrame *frame) #else frame->buf[0] = av_buffer_create(frame->data[0], 0, dxva_release_surface, frame->opaque, 0); if (!frame->buf[0]) { - ERR("failed to create AVBufferRef\n"); + LOG_SEVERE("failed to create AVBufferRef\n"); } #endif @@ -958,7 +946,7 @@ static void extract(void *dst, void *src) /* */ D3DLOCKED_RECT lock; if (FAILED(IDirect3DSurface9_LockRect(d3d, &lock, NULL, D3DLOCK_READONLY))) { - ERR("Failed to lock surface\n"); + LOG_SEVERE("Failed to lock surface\n"); return; } @@ -1005,7 +993,7 @@ static void extract(void *dst, void *src) av_image_fill_pointers(data, PIX_FMT_YUV420P, frame->height, dst, linesizes); copy_nv12(data, linesizes, plane, pitch, frame->width, frame->height); } else { - ERR("Not supported format.(%x)\n", dxva_ctx->render_fmt); + LOG_SEVERE("Not supported format.(%x)\n", dxva_ctx->render_fmt); IDirect3DSurface9_UnlockRect(d3d); return; } -- 2.7.4