radeon/uvd: move more logic into the common files
authorChristian König <christian.koenig@amd.com>
Mon, 9 Sep 2013 08:49:55 +0000 (10:49 +0200)
committerChristian König <christian.koenig@amd.com>
Thu, 12 Sep 2013 13:16:30 +0000 (15:16 +0200)
Move the code back into the common UVD files since we now
have base structures for R600 and radeonsi.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
src/gallium/drivers/r600/r600_pipe.c
src/gallium/drivers/r600/r600_pipe.h
src/gallium/drivers/r600/r600_uvd.c
src/gallium/drivers/radeon/radeon_uvd.c
src/gallium/drivers/radeon/radeon_uvd.h
src/gallium/drivers/radeonsi/radeonsi_uvd.c

index aa5cadf93e9bd6275062d7ae8be49a4dc61a3700..f60252ad3156d6f8ac43bb12c272cee7349576f6 100644 (file)
@@ -1293,7 +1293,7 @@ struct pipe_screen *r600_screen_create(struct radeon_winsys *ws)
        rscreen->b.b.get_driver_query_info = r600_get_driver_query_info;
 
        if (rscreen->b.info.has_uvd) {
-               rscreen->b.b.get_video_param = r600_uvd_get_video_param;
+               rscreen->b.b.get_video_param = ruvd_get_video_param;
                rscreen->b.b.is_video_format_supported = ruvd_is_format_supported;
        } else {
                rscreen->b.b.get_video_param = r600_get_video_param;
index 2ba0251dccff5d51bb40f2b00e30e8e39777e9ec..149197546100da074cbf08fab8e9a3f016eed577 100644 (file)
@@ -816,11 +816,6 @@ struct pipe_video_codec *r600_uvd_create_decoder(struct pipe_context *context,
 struct pipe_video_buffer *r600_video_buffer_create(struct pipe_context *pipe,
                                                   const struct pipe_video_buffer *tmpl);
 
-int r600_uvd_get_video_param(struct pipe_screen *screen,
-                            enum pipe_video_profile profile,
-                            enum pipe_video_entrypoint entrypoint,
-                            enum pipe_video_cap param);
-
 /*
  * Helpers for building command buffers
  */
index eeac76f3e2340278bd92ebdcb252edf19569f765..00669fd3171745e8609e84b79ff8af30cfbfa014 100644 (file)
@@ -167,33 +167,5 @@ static struct radeon_winsys_cs_handle* r600_uvd_set_dtb(struct ruvd_msg *msg, st
 struct pipe_video_codec *r600_uvd_create_decoder(struct pipe_context *context,
                                                   const struct pipe_video_codec *templat)
 {
-       struct r600_context *ctx = (struct r600_context *)context;
-
-       return ruvd_create_decoder(context, templat, ctx->b.ws, r600_uvd_set_dtb);
-}
-
-int r600_uvd_get_video_param(struct pipe_screen *screen,
-                            enum pipe_video_profile profile,
-                            enum pipe_video_entrypoint entrypoint,
-                            enum pipe_video_cap param)
-{
-       struct r600_screen *rscreen = (struct r600_screen *)screen;
-
-       /* UVD 2.x limits */
-       if (rscreen->b.family < CHIP_PALM) {
-               enum pipe_video_format codec = u_reduce_video_profile(profile);
-               switch (param) {
-               case PIPE_VIDEO_CAP_SUPPORTED:
-                       /* no support for MPEG4 */
-                       return codec != PIPE_VIDEO_FORMAT_MPEG4;
-               case PIPE_VIDEO_CAP_PREFERS_INTERLACED:
-               case PIPE_VIDEO_CAP_SUPPORTS_INTERLACED:
-                       /* and MPEG2 only with shaders */
-                       return codec != PIPE_VIDEO_FORMAT_MPEG12;
-               default:
-                       break;
-               }
-       }
-
-       return ruvd_get_video_param(screen, profile, entrypoint, param);
+       return ruvd_create_decoder(context, templat, r600_uvd_set_dtb);
 }
index 981d5c5f3264356270ca2ad87a7933fdcfd45649..518978eadf6836efe1fa25c58795735838c955e6 100644 (file)
@@ -46,6 +46,7 @@
 #include "vl/vl_mpeg12_decoder.h"
 
 #include "../../winsys/radeon/drm/radeon_winsys.h"
+#include "r600_pipe_common.h"
 #include "radeon_uvd.h"
 
 #define RUVD_ERR(fmt, args...) \
@@ -818,9 +819,9 @@ static void ruvd_flush(struct pipe_video_codec *decoder)
  */
 struct pipe_video_codec *ruvd_create_decoder(struct pipe_context *context,
                                             const struct pipe_video_codec *templ,
-                                            struct radeon_winsys* ws,
                                             ruvd_set_dtb set_dtb)
 {
+       struct radeon_winsys* ws = ((struct r600_common_context *)context)->ws;
        unsigned dpb_size = calc_dpb_size(templ);
        unsigned width = templ->width, height = templ->height;
        unsigned bs_buf_size;
@@ -1082,6 +1083,24 @@ int ruvd_get_video_param(struct pipe_screen *screen,
                         enum pipe_video_entrypoint entrypoint,
                         enum pipe_video_cap param)
 {
+       struct r600_common_screen *rscreen = (struct r600_common_screen *)screen;
+
+       /* UVD 2.x limits */
+       if (rscreen->family < CHIP_PALM) {
+               enum pipe_video_format codec = u_reduce_video_profile(profile);
+               switch (param) {
+               case PIPE_VIDEO_CAP_SUPPORTED:
+                       /* no support for MPEG4 */
+                       return codec != PIPE_VIDEO_FORMAT_MPEG4;
+               case PIPE_VIDEO_CAP_PREFERS_INTERLACED:
+               case PIPE_VIDEO_CAP_SUPPORTS_INTERLACED:
+                       /* and MPEG2 only with shaders */
+                       return codec != PIPE_VIDEO_FORMAT_MPEG12;
+               default:
+                       break;
+               }
+       }
+
        switch (param) {
        case PIPE_VIDEO_CAP_SUPPORTED:
                switch (u_reduce_video_profile(profile)) {
index dedb3c7040d72dcc3a4089dd0bd52954dc149288..b0135bac5d7ef60c09b88ccd473227da1c318492 100644 (file)
@@ -347,7 +347,6 @@ typedef struct radeon_winsys_cs_handle* (*ruvd_set_dtb)
 /* create an UVD decode */
 struct pipe_video_codec *ruvd_create_decoder(struct pipe_context *context,
                                             const struct pipe_video_codec *templat,
-                                            struct radeon_winsys* ws,
                                             ruvd_set_dtb set_dtb);
 
 /* join surfaces into the same buffer with identical tiling params
index de6cc12e45bb05ca09698c3cf5fac1a970e89207..1cb3be026d1385f12be2be652448df15e9f441fb 100644 (file)
@@ -149,7 +149,5 @@ static struct radeon_winsys_cs_handle* radeonsi_uvd_set_dtb(struct ruvd_msg *msg
 struct pipe_video_codec *radeonsi_uvd_create_decoder(struct pipe_context *context,
                                                     const struct pipe_video_codec *templ)
 {
-       struct r600_context *ctx = (struct r600_context *)context;
-
-       return ruvd_create_decoder(context, templ, ctx->b.ws, radeonsi_uvd_set_dtb);
+       return ruvd_create_decoder(context, templ, radeonsi_uvd_set_dtb);
 }