r300g: add winsys flag CAN_AACOMPRESS
authorMarek Olšák <maraeo@gmail.com>
Thu, 27 Jan 2011 22:13:28 +0000 (23:13 +0100)
committerMarek Olšák <maraeo@gmail.com>
Thu, 27 Jan 2011 22:13:28 +0000 (23:13 +0100)
src/gallium/drivers/r300/r300_winsys.h
src/gallium/winsys/radeon/drm/radeon_drm_common.c
src/gallium/winsys/radeon/drm/radeon_r300.c
src/gallium/winsys/radeon/drm/radeon_winsys.h

index 35ed35cca7cb4639e81dbcae0b16c35f2a72cd0e..05b572822548095de018c7bd320c919d29e887dc 100644 (file)
@@ -54,7 +54,8 @@ enum r300_value_id {
     R300_VID_DRM_2_3_0, /* R500 VAP regs, MSPOS regs, fixed tex3D size checking */
     R300_VID_DRM_2_6_0, /* Hyper-Z, GB_Z_PEQ_CONFIG on rv350->r4xx, R500 FG_ALPHA_VALUE */
     R300_VID_DRM_2_8_0, /* R500 US_FORMAT regs, R500 ARGB2101010 colorbuffer */
-    R300_CAN_HYPERZ,
+    R300_CAN_HYPERZ,     /* ZMask + HiZ */
+    R300_CAN_AACOMPRESS, /* CMask */
 };
 
 enum r300_reference_domain { /* bitfield */
index 3663c1fff6a29c3b09c04bbb2ec61bb539341844..ba548c4db5be37c1fc9d1925c4dc27354dc35a73 100644 (file)
 #include <xf86drm.h>
 #include <stdio.h>
 
-
-/* Enable/disable Hyper-Z access. Return TRUE on success. */
-static boolean radeon_set_hyperz_access(int fd, boolean enable)
-{
 #ifndef RADEON_INFO_WANT_HYPERZ
 #define RADEON_INFO_WANT_HYPERZ 7
 #endif
+#ifndef RADEON_INFO_WANT_CMASK
+#define RADEON_INFO_WANT_CMASK 8
+#endif
 
+/* Enable/disable feature access. Return TRUE on success. */
+static boolean radeon_set_fd_access(int fd, unsigned request, boolean enable)
+{
     struct drm_radeon_info info = {0};
     unsigned value = enable ? 1 : 0;
 
-    if (!debug_get_bool_option("RADEON_HYPERZ", FALSE))
-        return FALSE;
-
     info.value = (unsigned long)&value;
-    info.request = RADEON_INFO_WANT_HYPERZ;
+    info.request = request;
 
     if (drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)) != 0)
         return FALSE;
@@ -148,7 +147,15 @@ static void do_ioctls(struct radeon_drm_winsys *winsys)
     }
     winsys->z_pipes = target;
 
-    winsys->hyperz = radeon_set_hyperz_access(winsys->fd, TRUE);
+    if (debug_get_bool_option("RADEON_HYPERZ", FALSE)) {
+        winsys->hyperz = radeon_set_fd_access(winsys->fd,
+                                              RADEON_INFO_WANT_HYPERZ, TRUE);
+    }
+
+    if (debug_get_bool_option("RADEON_CMASK", FALSE)) {
+        winsys->aacompress = radeon_set_fd_access(winsys->fd,
+                                                  RADEON_INFO_WANT_CMASK, TRUE);
+    }
 
     retval = drmCommandWriteRead(winsys->fd, DRM_RADEON_GEM_INFO,
             &gem_info, sizeof(gem_info));
index 307ae01f5bb164777fc7a846a2c39b493fbad26c..91746bae8a9d9022c945360c371b5617d1a40dc0 100644 (file)
@@ -155,6 +155,8 @@ static uint32_t radeon_get_value(struct r300_winsys_screen *rws,
         return ws->drm_2_8_0;
     case R300_CAN_HYPERZ:
         return ws->hyperz;
+    case R300_CAN_AACOMPRESS:
+        return ws->aacompress;
     }
     return 0;
 }
index 76954d5d1a86acd718a40b1947157e35dedd3366..59e12ff6e6de89f2c11f541b9b47f592bb8e3a88 100644 (file)
@@ -53,8 +53,11 @@ struct radeon_drm_winsys {
     boolean drm_2_6_0;
     /* DRM 2.8.0 (US_FORMAT regs, ARGB2101010 colorbuffer) */
     boolean drm_2_8_0;
+
     /* Hyper-Z user */
     boolean hyperz;
+    /* AA compression (CMask) */
+    boolean aacompress;
 };
 
 static INLINE struct radeon_drm_winsys *