r300g: do not emit GB_Z_PEQ_CONFIG on non-r500 if DRM < 2.6.0
authorMarek Olšák <maraeo@gmail.com>
Thu, 5 Aug 2010 23:08:12 +0000 (01:08 +0200)
committerMarek Olšák <maraeo@gmail.com>
Fri, 6 Aug 2010 01:14:43 +0000 (03:14 +0200)
src/gallium/drivers/r300/r300_context.c
src/gallium/drivers/r300/r300_winsys.h
src/gallium/winsys/radeon/drm/radeon_drm.c
src/gallium/winsys/radeon/drm/radeon_r300.c
src/gallium/winsys/radeon/drm/radeon_winsys.h

index 4658ab0ff55c62f101d1d435ade205e36ef8a609..e8b6c4f7af8e90e78c580a082e1a31d97ee36726 100644 (file)
@@ -171,6 +171,7 @@ static void r300_setup_atoms(struct r300_context* r300)
     boolean is_r500 = r300->screen->caps.is_r500;
     boolean has_tcl = r300->screen->caps.has_tcl;
     boolean drm_2_3_0 = r300->rws->get_value(r300->rws, R300_VID_DRM_2_3_0);
+    boolean drm_2_6_0 = r300->rws->get_value(r300->rws, R300_VID_DRM_2_6_0);
     boolean has_hyperz = r300->rws->get_value(r300->rws, R300_CAN_HYPERZ);
     boolean has_hiz_ram = r300->screen->caps.hiz_ram > 0;
 
@@ -195,7 +196,7 @@ static void r300_setup_atoms(struct r300_context* r300)
     R300_INIT_ATOM(gpu_flush, 9);
     R300_INIT_ATOM(aa_state, 4);
     R300_INIT_ATOM(fb_state, 0);
-    R300_INIT_ATOM(hyperz_state, is_rv350 ? 10 : 8);
+    R300_INIT_ATOM(hyperz_state, is_r500 || (is_rv350 && drm_2_6_0) ? 10 : 8);
     /* ZB (unpipelined), SC. */
     R300_INIT_ATOM(ztop_state, 2);
     /* ZB, FG. */
@@ -373,7 +374,9 @@ static void r300_init_states(struct pipe_context *pipe)
         OUT_CB_REG(R300_ZB_DEPTHCLEARVALUE, 0);
         OUT_CB_REG(R300_SC_HYPERZ, R300_SC_HYPERZ_ADJ_2);
 
-        if (r300->screen->caps.is_rv350) {
+        if (r300->screen->caps.is_r500 ||
+            (r300->screen->caps.is_rv350 &&
+             r300->rws->get_value(r300->rws, R300_VID_DRM_2_6_0))) {
             OUT_CB_REG(R300_GB_Z_PEQ_CONFIG, 0);
         }
         END_CB;
index e7a1ede4fb40c78c4ee76ba1261a1b4def8078d5..187780750fa02bb77a1f78b20f14e94e5c97461c 100644 (file)
@@ -49,6 +49,7 @@ enum r300_value_id {
     R300_VID_Z_PIPES,
     R300_VID_SQUARE_TILING_SUPPORT,
     R300_VID_DRM_2_3_0,
+    R300_VID_DRM_2_6_0,
     R300_CAN_HYPERZ,
 };
 
index 3604827700336b1ba6bd110481d6e5db8be617d5..ecaf096dea2d13ed06eaec4620b6f2713b5e1096 100644 (file)
@@ -103,6 +103,10 @@ static void do_ioctls(int fd, struct radeon_libdrm_winsys* winsys)
     winsys->drm_2_3_0 = version->version_major > 2 ||
                         version->version_minor >= 3;
 
+    winsys->drm_2_6_0 = version->version_major > 2 ||
+                        (version->version_major == 2 &&
+                         version->version_minor >= 6);
+
     info.request = RADEON_INFO_DEVICE_ID;
     retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info));
     if (retval) {
index 955ae4c04558d99fdf789303d0cff4d32b7224a1..584009864215ef86dea769b934bc81255cbd339d 100644 (file)
@@ -211,6 +211,8 @@ static uint32_t radeon_get_value(struct r300_winsys_screen *rws,
         return ws->squaretiling;
     case R300_VID_DRM_2_3_0:
         return ws->drm_2_3_0;
+    case R300_VID_DRM_2_6_0:
+        return ws->drm_2_6_0;
     case R300_CAN_HYPERZ:
         return ws->hyperz;
     }
index 52db0d62d23db893e238a01531048843a56112af..6f4aa4bce30c2cfc28629cb4b1e4dbac9d6a7c54 100644 (file)
@@ -65,6 +65,12 @@ struct radeon_libdrm_winsys {
      */
     boolean drm_2_3_0;
 
+    /* DRM 2.6.0
+     *   - Hyper-Z
+     *   - GB_Z_PEQ_CONFIG allowed on rv350->r4xx, we should initialize it
+     */
+    boolean drm_2_6_0;
+
     /* hyperz user */
     boolean hyperz;