r600g/llvm: Don't feed LLVM output through r600_bytecode_build()
[mesa.git] / src / gallium / drivers / r600 / r600_uvd.c
index bdda7e148c6092bad5797419711961c8c5badeee..6a3974c6b2703f2af81d6934e2d147f7feb0f934 100644 (file)
@@ -61,7 +61,7 @@ struct pipe_video_buffer *r600_video_buffer_create(struct pipe_context *pipe,
        const enum pipe_format *resource_formats;
        struct pipe_video_buffer template;
        struct pipe_resource templ;
-       unsigned i, depth;
+       unsigned i, array_size;
 
        assert(pipe);
 
@@ -70,19 +70,23 @@ struct pipe_video_buffer *r600_video_buffer_create(struct pipe_context *pipe,
        if (!resource_formats)
                return NULL;
 
-       depth = tmpl->interlaced ? 2 : 1;
+       array_size = tmpl->interlaced ? 2 : 1;
        template = *tmpl;
        template.width = align(tmpl->width, VL_MACROBLOCK_WIDTH);
-       template.height = align(tmpl->height / depth, VL_MACROBLOCK_HEIGHT);
+       template.height = align(tmpl->height / array_size, VL_MACROBLOCK_HEIGHT);
 
-       vl_vide_buffer_template(&templ, &template, resource_formats[0], depth, PIPE_USAGE_STATIC, 0);
+       vl_video_buffer_template(&templ, &template, resource_formats[0], 1, array_size, PIPE_USAGE_STATIC, 0);
+       if (ctx->chip_class < EVERGREEN || tmpl->interlaced)
+               templ.flags = R600_RESOURCE_FLAG_TRANSFER;
        resources[0] = (struct r600_texture *)
                pipe->screen->resource_create(pipe->screen, &templ);
        if (!resources[0])
                goto error;
 
        if (resource_formats[1] != PIPE_FORMAT_NONE) {
-               vl_vide_buffer_template(&templ, &template, resource_formats[1], depth, PIPE_USAGE_STATIC, 1);
+               vl_video_buffer_template(&templ, &template, resource_formats[1], 1, array_size, PIPE_USAGE_STATIC, 1);
+               if (ctx->chip_class < EVERGREEN || tmpl->interlaced)
+                       templ.flags = R600_RESOURCE_FLAG_TRANSFER;
                resources[1] = (struct r600_texture *)
                        pipe->screen->resource_create(pipe->screen, &templ);
                if (!resources[1])
@@ -90,7 +94,9 @@ struct pipe_video_buffer *r600_video_buffer_create(struct pipe_context *pipe,
        }
 
        if (resource_formats[2] != PIPE_FORMAT_NONE) {
-               vl_vide_buffer_template(&templ, &template, resource_formats[2], depth, PIPE_USAGE_STATIC, 2);
+               vl_video_buffer_template(&templ, &template, resource_formats[2], 1, array_size, PIPE_USAGE_STATIC, 2);
+               if (ctx->chip_class < EVERGREEN || tmpl->interlaced)
+                       templ.flags = R600_RESOURCE_FLAG_TRANSFER;
                resources[2] = (struct r600_texture *)
                        pipe->screen->resource_create(pipe->screen, &templ);
                if (!resources[2])
@@ -103,11 +109,6 @@ struct pipe_video_buffer *r600_video_buffer_create(struct pipe_context *pipe,
 
                pbs[i] = &resources[i]->resource.buf;
                surfaces[i] = &resources[i]->surface;
-
-               if (ctx->chip_class < EVERGREEN) {
-                       resources[i]->array_mode[0] = V_038000_ARRAY_LINEAR_ALIGNED;
-                       resources[i]->surface.level[0].mode = RADEON_SURF_MODE_LINEAR_ALIGNED;
-               }
        }
 
        ruvd_join_surfaces(ctx->ws, templ.bind, pbs, surfaces);
@@ -121,7 +122,7 @@ struct pipe_video_buffer *r600_video_buffer_create(struct pipe_context *pipe,
                        resources[i]->resource.buf);
        }
 
-       template.height *= depth;
+       template.height *= array_size;
        return vl_video_buffer_create_ex2(pipe, &template, (struct pipe_resource **)resources);
 
 error:
@@ -154,8 +155,8 @@ static struct radeon_winsys_cs_handle* r600_uvd_set_dtb(struct ruvd_msg *msg, st
        struct r600_texture *luma = (struct r600_texture *)buf->resources[0];
        struct r600_texture *chroma = (struct r600_texture *)buf->resources[1];
 
-       msg->decode.dt_field_mode = buf->base.interlaced;
-       msg->decode.dt_surf_tile_config |= RUVD_NUM_BANKS(eg_num_banks(rscreen->tiling_info.num_banks));
+       msg->body.decode.dt_field_mode = buf->base.interlaced;
+       msg->body.decode.dt_surf_tile_config |= RUVD_NUM_BANKS(eg_num_banks(rscreen->tiling_info.num_banks));
 
        ruvd_set_dt_surfaces(msg, &luma->surface, &chroma->surface);
 
@@ -176,3 +177,17 @@ struct pipe_video_decoder *r600_uvd_create_decoder(struct pipe_context *context,
                                   width, height, max_references, expect_chunked_decode,
                                   ctx->ws, r600_uvd_set_dtb);
 }
+
+int r600_uvd_get_video_param(struct pipe_screen *screen,
+                            enum pipe_video_profile profile,
+                            enum pipe_video_cap param)
+{
+       struct r600_screen *rscreen = (struct r600_screen *)screen;
+
+       /* No support for MPEG4 on UVD 2.x */
+       if (param == PIPE_VIDEO_CAP_SUPPORTED && rscreen->family < CHIP_CEDAR &&
+           u_reduce_video_profile(profile) == PIPE_VIDEO_CODEC_MPEG4)
+               return false;
+
+       return ruvd_get_video_param(screen, profile, param);
+}