Skip to contentSkip to conversation

nv50: enable h264 and mpeg4 for nv98+ (vp3, vp4.0)

PATCH New Ilia Mirkin 1 participant 3 messages Dec 8, 2013 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 nv50: enable h264 and mpeg4 for nv98+ (vp3, vp4.0)

Create the ref_bo without any storage type flags set for now. The issue probably arises from our use of the additional buffer space at the end of the ref_bo. It should probably be split up in the future.

---
 src/gallium/drivers/nouveau/nouveau_vp3_video.c | 7 +------
 src/gallium/drivers/nouveau/nv50/nv98_video.c   | 2 +-
 2 files changed, 2 insertions(+), 7 deletions(-)
src/gallium/drivers/nouveau/nouveau_vp3_video.c +1 -6
index 07ce016..ff00b37 100644
@@ -362,12 +362,7 @@ nouveau_vp3_screen_get_video_param(struct pipe_screen *pscreen,
    enum pipe_video_format codec = u_reduce_video_profile(profile);
    switch (param) {
    case PIPE_VIDEO_CAP_SUPPORTED:
-      /* For now, h264 and mpeg4 don't work on pre-nvc0. */
-      if (chipset < 0xc0)
-         return codec == PIPE_VIDEO_FORMAT_MPEG12 ||
-            codec == PIPE_VIDEO_FORMAT_VC1;
-      /* In the general case, this should work, once the pre-nvc0 problems are
-       * resolved. */
+      /* VP3 does not support MPEG4, VP4+ do. */
       return profile >= PIPE_VIDEO_PROFILE_MPEG1 && (
             !vp3 || codec != PIPE_VIDEO_FORMAT_MPEG4);
    case PIPE_VIDEO_CAP_NPOT_TEXTURES:
src/gallium/drivers/nouveau/nv50/nv98_video.c +1 -1
index 069481d..f748c81 100644
@@ -200,7 +200,7 @@ nv98_create_decoder(struct pipe_context *context,
    dec->ref_stride = mb(templ->width)*16 * (mb_half(templ->height)*32 + nouveau_vp3_video_align(templ->height)/2);
    ret = nouveau_bo_new(screen->device, NOUVEAU_BO_VRAM, 0,
                         dec->ref_stride * (templ->max_references+2) + tmp_size,
-                        &cfg, &dec->ref_bo);
+                        NULL, &dec->ref_bo);
    if (ret)
       goto fail;
 
Signature · 1 line
1.8.3.2

A message that is not in the archive (sent off-list or not yet received): 1386480721-10167-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/[email protected]

#2 lore raw

PATCH 2/3 nouveau/video: update h264 picparm field names based on usage

---
 src/gallium/drivers/nouveau/nouveau_vp3_video_vp.c | 28 ++++++++++------------
 1 file changed, 13 insertions(+), 15 deletions(-)
src/gallium/drivers/nouveau/nouveau_vp3_video_vp.c +13 -15
index a0f5332..ad4a586 100644
@@ -118,10 +118,10 @@ struct h264_picparm_vp { // 700..a00
 	uint32_t bucket_size; // 28 bucket size
 	uint32_t inter_ring_data_size; // 2c
 
-	unsigned f0 : 1; // 0 0x01: into 640 shifted by 3, 540 shifted by 5, half size something?
-	unsigned f1 : 1; // 1 0x02: into vuc ofs 56
+	unsigned mb_adaptive_frame_field_flag : 1; // 0
+	unsigned direct_8x8_inference_flag : 1; // 1 0x02: into vuc ofs 56
 	unsigned weighted_pred_flag : 1; // 2 0x04
-	unsigned f3 : 1; // 3 0x08: into vuc ofs 68
+	unsigned constrained_intra_pred_flag : 1; // 3 0x08: into vuc ofs 68
 	unsigned is_reference : 1; // 4
 	unsigned interlace : 1; // 5 field_pic_flag
 	unsigned bottom_field_flag : 1; // 6
@@ -144,15 +144,13 @@ struct h264_picparm_vp { // 700..a00
 	uint32_t field_order_cnt[2]; // 38, 3c
 
 	struct { // 40
-		// 0x00223102
-		// nfi (needs: top_is_reference, bottom_is_reference, is_long_term, maybe some other state that was saved..
 		unsigned fifo_idx : 7; // 00 0..6
 		unsigned tmp_idx : 5; // 00 7..11
-		unsigned unk12 : 1; // 00 12 not seen yet, but set, maybe top_is_reference
-		unsigned unk13 : 1; // 00 13 not seen yet, but set, maybe bottom_is_reference?
+		unsigned top_is_reference : 1; // 00 12
+		unsigned bottom_is_reference : 1; // 00 13
 		unsigned unk14 : 1; // 00 14 skipped?
 		unsigned notseenyet : 1; // 00 15 pad?
-		unsigned unk16 : 1; // 00 16
+		unsigned field_pic_flag : 1; // 00 16
 		unsigned unk17 : 4; // 00 17..20
 		unsigned unk21 : 4; // 00 21..24
 		unsigned pad : 7; // 00 d25..31
@@ -340,10 +338,10 @@ nouveau_vp3_fill_picparm_h264_vp(struct nouveau_vp3_decoder *dec,
    nouveau_vp3_inter_sizes(dec, 1, &ring, &h->bucket_size, &h->inter_ring_data_size);
 
    h->u220 = 0;
-   h->f0 = d->pps->sps->mb_adaptive_frame_field_flag;
-   h->f1 = d->pps->sps->direct_8x8_inference_flag;
+   h->mb_adaptive_frame_field_flag = d->pps->sps->mb_adaptive_frame_field_flag;
+   h->direct_8x8_inference_flag = d->pps->sps->direct_8x8_inference_flag;
    h->weighted_pred_flag = d->pps->weighted_pred_flag;
-   h->f3 = d->pps->constrained_intra_pred_flag;
+   h->constrained_intra_pred_flag = d->pps->constrained_intra_pred_flag;
    h->is_reference = d->is_reference;
    h->interlace = d->field_pic_flag;
    h->bottom_field_flag = d->bottom_field_flag;
@@ -376,12 +374,12 @@ nouveau_vp3_fill_picparm_h264_vp(struct nouveau_vp3_decoder *dec,
       h->refs[j].field_order_cnt[1] = d->field_order_cnt_list[i][1];
       h->refs[j].frame_idx = d->frame_num_list[i];
       if (!dec->refs[refs[j]->valid_ref].field_pic_flag) {
-         h->refs[j].unk12 = d->top_is_reference[i];
-         h->refs[j].unk13 = d->bottom_is_reference[i];
+         h->refs[j].top_is_reference = d->top_is_reference[i];
+         h->refs[j].bottom_is_reference = d->bottom_is_reference[i];
       }
       h->refs[j].unk14 = 0;
       h->refs[j].notseenyet = 0;
-      h->refs[j].unk16 = dec->refs[refs[j]->valid_ref].field_pic_flag;
+      h->refs[j].field_pic_flag = dec->refs[refs[j]->valid_ref].field_pic_flag;
       h->refs[j].unk17 = dec->refs[refs[j]->valid_ref].decoded_top &&
                          d->top_is_reference[i];
       h->refs[j].unk21 = dec->refs[refs[j]->valid_ref].decoded_bottom &&
@@ -395,7 +393,7 @@ nouveau_vp3_fill_picparm_h264_vp(struct nouveau_vp3_decoder *dec,
    assert(d->num_ref_frames <= dec->base.max_references);
 
    for (; i < d->num_ref_frames; ++i)
-      h->refs[j].unk16 = d->field_pic_flag;
+      h->refs[j].field_pic_flag = d->field_pic_flag;
    *(struct h264_picparm_vp *)map = *h;
 
    return 0x1113;
Signature · 1 line
1.8.3.2
#3 lore raw

PATCH 3/3 nouveau/video: update a few more h264 picparm field names

In reply to a message not in the archive

Based on comments by Benjamin Morris <[email protected]> in
http://lists.freedesktop.org/archives/nouveau/2013-December/015328.html

This adds setting of is_long_term, and updates a few field names we were unclear about.

---
 src/gallium/drivers/nouveau/nouveau_vp3_video_vp.c | 33 +++++++++++-----------
 1 file changed, 17 insertions(+), 16 deletions(-)
src/gallium/drivers/nouveau/nouveau_vp3_video_vp.c +17 -16
index ad4a586..1130d10 100644
@@ -114,7 +114,7 @@ struct h264_picparm_vp { // 700..a00
 	uint32_t stride1, stride2; // 04 08
 	uint32_t ofs[6]; // 0c..24 in-image offset
 
-	uint32_t u24; // nfi ac8 ?
+	uint32_t tmp_stride;
 	uint32_t bucket_size; // 28 bucket size
 	uint32_t inter_ring_data_size; // 2c
 
@@ -125,10 +125,10 @@ struct h264_picparm_vp { // 700..a00
 	unsigned is_reference : 1; // 4
 	unsigned interlace : 1; // 5 field_pic_flag
 	unsigned bottom_field_flag : 1; // 6
-	unsigned f7 : 1; // 7 0x80: nfi yet
+	unsigned second_field : 1; // 7 0x80: nfi yet
 
 	signed log2_max_frame_num_minus4 : 4; // 31 0..3
-	unsigned u31_45 : 2; // 31 4..5
+	unsigned chroma_format_idc : 2; // 31 4..5
 	unsigned pic_order_cnt_type : 2; // 31 6..7
 	signed pic_init_qp_minus26 : 6; // 32 0..5
 	signed chroma_qp_index_offset : 5; // 32 6..10
@@ -148,11 +148,11 @@ struct h264_picparm_vp { // 700..a00
 		unsigned tmp_idx : 5; // 00 7..11
 		unsigned top_is_reference : 1; // 00 12
 		unsigned bottom_is_reference : 1; // 00 13
-		unsigned unk14 : 1; // 00 14 skipped?
+		unsigned is_long_term : 1; // 00 14
 		unsigned notseenyet : 1; // 00 15 pad?
 		unsigned field_pic_flag : 1; // 00 16
-		unsigned unk17 : 4; // 00 17..20
-		unsigned unk21 : 4; // 00 21..24
+		unsigned top_field_marking : 4; // 00 17..20
+		unsigned bottom_field_marking : 4; // 00 21..24
 		unsigned pad : 7; // 00 d25..31
 
 		uint32_t field_order_cnt[2]; // 04,08
@@ -333,8 +333,8 @@ nouveau_vp3_fill_picparm_h264_vp(struct nouveau_vp3_decoder *dec,
    nouveau_vp3_ycbcr_offsets(dec, &h->ofs[1], &h->ofs[3], &h->ofs[4]);
    h->ofs[5] = h->ofs[3];
    h->ofs[0] = h->ofs[2] = 0;
-   h->u24 = dec->tmp_stride >> 8;
-   assert(h->u24);
+   h->tmp_stride = dec->tmp_stride >> 8;
+   assert(h->tmp_stride);
    nouveau_vp3_inter_sizes(dec, 1, &ring, &h->bucket_size, &h->inter_ring_data_size);
 
    h->u220 = 0;
@@ -345,9 +345,9 @@ nouveau_vp3_fill_picparm_h264_vp(struct nouveau_vp3_decoder *dec,
    h->is_reference = d->is_reference;
    h->interlace = d->field_pic_flag;
    h->bottom_field_flag = d->bottom_field_flag;
-   h->f7 = 0; // TODO: figure out when set..
+   h->second_field = 0; // TODO: figure out when set..
    h->log2_max_frame_num_minus4 = d->pps->sps->log2_max_frame_num_minus4;
-   h->u31_45 = 1;
+   h->chroma_format_idc = 1;
 
    h->pic_order_cnt_type = d->pps->sps->pic_order_cnt_type;
    h->pic_init_qp_minus26 = d->pps->pic_init_qp_minus26;
@@ -377,15 +377,16 @@ nouveau_vp3_fill_picparm_h264_vp(struct nouveau_vp3_decoder *dec,
          h->refs[j].top_is_reference = d->top_is_reference[i];
          h->refs[j].bottom_is_reference = d->bottom_is_reference[i];
       }
-      h->refs[j].unk14 = 0;
+      h->refs[j].is_long_term = d->is_long_term[i];
       h->refs[j].notseenyet = 0;
       h->refs[j].field_pic_flag = dec->refs[refs[j]->valid_ref].field_pic_flag;
-      h->refs[j].unk17 = dec->refs[refs[j]->valid_ref].decoded_top &&
-                         d->top_is_reference[i];
-      h->refs[j].unk21 = dec->refs[refs[j]->valid_ref].decoded_bottom &&
-                         d->bottom_is_reference[i];
+      h->refs[j].top_field_marking =
+         dec->refs[refs[j]->valid_ref].decoded_top && d->top_is_reference[i] ?
+         1 + d->is_long_term[i] : 0;
+      h->refs[j].bottom_field_marking =
+         dec->refs[refs[j]->valid_ref].decoded_bottom && d->bottom_is_reference[i] ?
+         1 + d->is_long_term[i] : 0;
       h->refs[j].pad = 0;
-      assert(!d->is_long_term[i]);
       j++;
    }
    for (; i < 16; ++i)
Signature · 1 line
1.8.3.2