[Libva] [PATCH intel-driver 02/13] vebox: drop magic numbers in filters mask.

Gwenole Beauchesne gb.devel at gmail.com
Wed Aug 27 04:50:27 PDT 2014


Use the existing VPP_{DNDI,IECP}_xxx flags instead of magic numbers.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne at intel.com>
---
 src/gen75_vpp_vebox.c |   16 ++++++++--------
 src/gen75_vpp_vebox.h |    2 ++
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/gen75_vpp_vebox.c b/src/gen75_vpp_vebox.c
index f452e67..76ecc6b 100644
--- a/src/gen75_vpp_vebox.c
+++ b/src/gen75_vpp_vebox.c
@@ -626,7 +626,7 @@ void hsw_veb_iecp_aoi_table(VADriverContextP ctx, struct intel_vebox_context *pr
 
 void hsw_veb_state_table_setup(VADriverContextP ctx, struct intel_vebox_context *proc_ctx)
 {
-    if(proc_ctx->filters_mask & 0x000000ff) {
+    if(proc_ctx->filters_mask & VPP_DNDI_MASK) {
         dri_bo *dndi_bo = proc_ctx->dndi_state_table.bo;
         dri_bo_map(dndi_bo, 1);
         proc_ctx->dndi_state_table.ptr = dndi_bo->virtual;
@@ -636,7 +636,7 @@ void hsw_veb_state_table_setup(VADriverContextP ctx, struct intel_vebox_context
         dri_bo_unmap(dndi_bo);
     }
 
-    if(proc_ctx->filters_mask & 0x0000ff00) {
+    if(proc_ctx->filters_mask & VPP_IECP_MASK) {
         dri_bo *iecp_bo = proc_ctx->iecp_state_table.bo;
         dri_bo_map(iecp_bo, 1);
         proc_ctx->iecp_state_table.ptr = iecp_bo->virtual;
@@ -655,9 +655,9 @@ void hsw_veb_state_table_setup(VADriverContextP ctx, struct intel_vebox_context
 void hsw_veb_state_command(VADriverContextP ctx, struct intel_vebox_context *proc_ctx)
 {
     struct intel_batchbuffer *batch = proc_ctx->batch;
-    unsigned int is_dn_enabled   = (proc_ctx->filters_mask & 0x01)? 1: 0;
-    unsigned int is_di_enabled   = (proc_ctx->filters_mask & 0x02)? 1: 0;
-    unsigned int is_iecp_enabled = (proc_ctx->filters_mask & 0xff00)?1:0;
+    unsigned int is_dn_enabled   = !!(proc_ctx->filters_mask & VPP_DNDI_DN);
+    unsigned int is_di_enabled   = !!(proc_ctx->filters_mask & VPP_DNDI_DI);
+    unsigned int is_iecp_enabled = !!(proc_ctx->filters_mask & VPP_IECP_MASK);
     unsigned int is_first_frame  = !!((proc_ctx->frame_order == -1) &&
                                       (is_di_enabled ||
                                        is_dn_enabled));
@@ -1446,9 +1446,9 @@ struct intel_vebox_context * gen75_vebox_context_init(VADriverContextP ctx)
 void bdw_veb_state_command(VADriverContextP ctx, struct intel_vebox_context *proc_ctx)
 {
     struct intel_batchbuffer *batch = proc_ctx->batch;
-    unsigned int is_dn_enabled   = (proc_ctx->filters_mask & 0x01)? 1: 0;
-    unsigned int is_di_enabled   = (proc_ctx->filters_mask & 0x02)? 1: 0;
-    unsigned int is_iecp_enabled = (proc_ctx->filters_mask & 0xff00)?1:0;
+    unsigned int is_dn_enabled   = !!(proc_ctx->filters_mask & VPP_DNDI_DN);
+    unsigned int is_di_enabled   = !!(proc_ctx->filters_mask & VPP_DNDI_DI);
+    unsigned int is_iecp_enabled = !!(proc_ctx->filters_mask & VPP_IECP_MASK);
     unsigned int is_first_frame  = !!((proc_ctx->frame_order == -1) &&
                                       (is_di_enabled ||
                                        is_dn_enabled));
diff --git a/src/gen75_vpp_vebox.h b/src/gen75_vpp_vebox.h
index a78a165..a0842b0 100644
--- a/src/gen75_vpp_vebox.h
+++ b/src/gen75_vpp_vebox.h
@@ -43,12 +43,14 @@
 
 #define VPP_DNDI_DN        0x00000001
 #define VPP_DNDI_DI        0x00000002
+#define VPP_DNDI_MASK      0x000000ff
 #define VPP_IECP_STD_STE   0x00000100
 #define VPP_IECP_ACE       0x00000200
 #define VPP_IECP_TCC       0x00000400
 #define VPP_IECP_PRO_AMP   0x00000800
 #define VPP_IECP_CSC       0x00001000
 #define VPP_IECP_AOI       0x00002000
+#define VPP_IECP_MASK      0x0000ff00
 #define MAX_FILTER_SUM     8
 
 #define PRE_FORMAT_CONVERT      0x01
-- 
1.7.9.5



More information about the Libva mailing list