Merge branch 'gallium-drm-driver-drescriptor'
authorJakob Bornecrantz <jakob@vmware.com>
Mon, 28 Jun 2010 18:59:09 +0000 (20:59 +0200)
committerJakob Bornecrantz <jakob@vmware.com>
Mon, 28 Jun 2010 19:14:45 +0000 (21:14 +0200)
Conflicts:
src/gallium/state_trackers/egl/x11/native_dri2.c
src/gallium/state_trackers/egl/x11/native_x11.c
src/gallium/state_trackers/egl/x11/native_x11.h
src/gallium/state_trackers/xorg/xorg_driver.c
src/gallium/winsys/radeon/drm/radeon_drm.c

18 files changed:
1  2 
configure.ac
src/gallium/drivers/galahad/Makefile
src/gallium/drivers/galahad/SConscript
src/gallium/drivers/i915/i915_screen.c
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r300/r300_texture.c
src/gallium/drivers/r300/r300_winsys.h
src/gallium/state_trackers/egl/kms/native_kms.c
src/gallium/state_trackers/egl/x11/native_dri2.c
src/gallium/state_trackers/egl/x11/native_x11.c
src/gallium/state_trackers/egl/x11/native_x11.h
src/gallium/state_trackers/xorg/xorg_driver.c
src/gallium/state_trackers/xorg/xorg_tracker.h
src/gallium/targets/dri-radeong/Makefile
src/gallium/targets/egl-radeon/Makefile
src/gallium/targets/xorg-radeon/Makefile
src/gallium/winsys/r600/drm/r600_drm.c
src/gallium/winsys/radeon/drm/radeon_r300.c

diff --cc configure.ac
Simple merge
index 67d087456626256e8f9af911225e02ecf9c23173,0000000000000000000000000000000000000000..e9c4f7e28c81167896980503b66ab0fb8e7d4390
mode 100644,000000..100644
--- /dev/null
@@@ -1,12 -1,0 +1,11 @@@
-       glhd_screen.c \
-       glhd_drm.c
 +TOP = ../../../..
 +include $(TOP)/configs/current
 +
 +LIBNAME = galahad
 +
 +C_SOURCES = \
 +      glhd_objects.c \
 +      glhd_context.c \
++      glhd_screen.c
 +
 +include ../../Makefile.template
index fc668facaf563d7fe01cfbd1832ca95598b24181,0000000000000000000000000000000000000000..ca6213cfff14af209f802f8759b65dac4430284f
mode 100644,000000..100644
--- /dev/null
@@@ -1,14 -1,0 +1,13 @@@
-               'glhd_drm.c',
 +Import('*')
 +
 +env = env.Clone()
 +
 +identity = env.ConvenienceLibrary(
 +      target = 'identity',
 +      source = [
 +              'glhd_context.c',
 +              'glhd_objects.c',
 +              'glhd_screen.c',
 +      ])
 +
 +Export('identity')
index ddb66000561314e4f65e7c03fcdfcffeb021fd52,5a013e2a25a28a1ce79ce6c9d0895a495071d425..6206570fca473ecf417a28b1c2374ddb52040f49
  #include "r300_screen.h"
  #include "r300_winsys.h"
  
 -#define TILE_WIDTH 0
 -#define TILE_HEIGHT 1
 +#include "util/u_format.h"
 +#include "util/u_format_s3tc.h"
 +#include "util/u_math.h"
 +#include "util/u_memory.h"
 +
 +#include "pipe/p_screen.h"
- #include "state_tracker/drm_api.h"
 -static const unsigned microblock_table[5][3][2] = {
 -    /*linear  tiled   square-tiled */
 -    {{32, 1}, {8, 4}, {0, 0}}, /*   8 bits per pixel */
 -    {{16, 1}, {8, 2}, {4, 4}}, /*  16 bits per pixel */
 -    {{ 8, 1}, {4, 2}, {0, 0}}, /*  32 bits per pixel */
 -    {{ 4, 1}, {0, 0}, {2, 2}}, /*  64 bits per pixel */
 -    {{ 2, 1}, {0, 0}, {0, 0}}  /* 128 bits per pixel */
++/* XXX NO! just no! */
++#include "state_tracker/drm_driver.h"
 +
 +enum r300_dim {
 +    DIM_WIDTH  = 0,
 +    DIM_HEIGHT = 1
  };
  
  unsigned r300_get_swizzle_combined(const unsigned char *swizzle_format,
@@@ -1081,7 -1051,7 +1083,8 @@@ r300_texture_from_handle(struct pipe_sc
          return NULL;
      }
  
 -    buffer = rws->buffer_from_handle(rws, screen, whandle, &stride);
++    /* XXX make the winsys return the stride_override, see i915_resource_texture.c:830 */
 +    buffer = rws->buffer_from_handle(rws, whandle->handle);
      if (!buffer) {
          return NULL;
      }
index e90c33b824d383a7fb848de4c529afa127219897,0ce7c0be64b358661a652572c18b44104076b941..7464354fe6151410460d8934e15d2325bce0c5ae
@@@ -741,9 -738,8 +738,8 @@@ dri2_display_hash_table_compare(void *k
  }
  
  struct native_display *
 -x11_create_dri2_display(EGLNativeDisplayType dpy,
 +x11_create_dri2_display(Display *dpy,
-                         struct native_event_handler *event_handler,
-                         struct drm_api *api)
+                         struct native_event_handler *event_handler)
  {
     struct dri2_display *dri2dpy;
  
index bfa12b26a77487d922a6e1ac42df244558f387d6,5d71778410b5c5d778db0ea378d3d519517e2e1c..6f1e5998732c547a72fc93c9b435f34535406fdf
@@@ -132,12 -123,12 +122,12 @@@ native_create_display(void *dpy, struc
     struct native_display *ndpy = NULL;
     boolean force_sw;
  
-    if (!api)
-       api = drm_api_create();
     force_sw = debug_get_bool_option("EGL_SOFTWARE", FALSE);
-    if (api && !force_sw) {
-       ndpy = x11_create_dri2_display((Display *) dpy, event_handler, api);
+    if (!driver_descriptor.create_screen)
+       force_sw = TRUE;
+    if (!force_sw) {
 -      ndpy = x11_create_dri2_display(dpy, event_handler);
++      ndpy = x11_create_dri2_display((Display *) dpy, event_handler);
     }
  
     if (!ndpy) {
index f1fea7f3de43557609d4cba6603706321c49a6f1,e16da935c0b85bcf4a7c56a0f68a14d25d665238..a1c32c3455a4a370ece7245424edcbea31dc352d
@@@ -34,8 -33,7 +33,7 @@@ x11_create_ximage_display(Display *dpy
                            struct native_event_handler *event_handler);
  
  struct native_display *
 -x11_create_dri2_display(EGLNativeDisplayType dpy,
 +x11_create_dri2_display(Display *dpy,
-                         struct native_event_handler *event_handler,
-                         struct drm_api *api);
+                         struct native_event_handler *event_handler);
  
  #endif /* _NATIVE_X11_H_ */
index a7e57634aec0aa9b6fcede624817a0f3c63578f3,9357cd5763fcc89e83f701ba77b5a7406397ccbd..c69d75e22e85f94aa19d4b6db82d4b5e07e90b0b
@@@ -316,18 -305,10 +307,11 @@@ drv_init_resource_management(ScrnInfoPt
      if (ms->screen || ms->kms)
        return TRUE;
  
-     if (ms->api) {
-       ms->screen = ms->no3D ? NULL :
-           ms->api->create_screen(ms->api, ms->fd);
-       if (ms->screen)
-           return TRUE;
-       if (ms->api->destroy)
-           ms->api->destroy(ms->api);
 -    ms->screen = driver_descriptor.create_screen(ms->fd);
++    if (!ms->no3D)
++      ms->screen = driver_descriptor.create_screen(ms->fd);
  
-       ms->api = NULL;
-     }
+     if (ms->screen)
+       return TRUE;
  
  #ifdef HAVE_LIBKMS
      if (!kms_create(ms->fd, &ms->kms))
index 64c20afc2beaa8d7a9c52b84c47ac1ae3d3cc3a7,2adc027b8f05a20e6e6a129defb21ce5bdd974b3..79426836db4216abdfe3b8adb27d13c591a4ce3a
@@@ -2,12 -2,14 +2,15 @@@ TOP = ../../../.
  include $(TOP)/configs/current
  
  EGL_DRIVER_NAME = radeon
- EGL_DRIVER_SOURCES = dummy.c
+ EGL_DRIVER_SOURCES = target.c
  EGL_DRIVER_LIBS = -ldrm_radeon
  
+ EGL_DRIVER_DEFINES = \
+       -DGALLIUM_RBUG -DGALLIUM_TRACE
  EGL_DRIVER_PIPES = \
        $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
 +      $(TOP)/src/gallium/drivers/galahad/libgalahad.a \
        $(TOP)/src/gallium/drivers/trace/libtrace.a \
        $(TOP)/src/gallium/drivers/rbug/librbug.a \
        $(TOP)/src/gallium/drivers/r300/libr300.a
index 803049d58c99d7a3a1fb88547a02d7ea591a7338,469f1446d051af86e87c5694fea4df301bb72c5d..3d87a994c150a4bc0453faf281605d0e552e4fa3
@@@ -48,42 -45,18 +45,21 @@@ boolean r600_buffer_get_handle(struct r
                               struct winsys_handle *whandle)
  {
        struct drm_gem_flink flink;
 -      struct r600_buffer* rbuffer;
 -      int r;
 +      struct r600_buffer* rbuffer = (struct r600_buffer*)buf;
  
 -      rbuffer = (struct r600_buffer*)buf;
 -      if (!rbuffer->flink) {
 -              flink.handle = rbuffer->bo->handle;
 -              r = ioctl(rw->fd, DRM_IOCTL_GEM_FLINK, &flink);
 -              if (r) {
 -                      return FALSE;
 +      if (whandle->type == DRM_API_HANDLE_TYPE_SHARED) {
 +              if (!rbuffer->flink) {
 +                      flink.handle = rbuffer->bo->handle;
 +
 +                      if (ioctl(rw->fd, DRM_IOCTL_GEM_FLINK, &flink)) {
 +                              return FALSE;
 +                      }
 +
 +                      rbuffer->flink = flink.name;
                }
 -              rbuffer->flink = flink.name;
 +              whandle->handle = rbuffer->flink;
 +      } else if (whandle->type == DRM_API_HANDLE_TYPE_KMS) {
 +              whandle->handle = rbuffer->bo->handle;
        }
 -      whandle->handle = rbuffer->flink;
        return TRUE;
  }
- static void r600_drm_api_destroy(struct drm_api *api)
- {
-       return;
- }
- struct drm_api drm_api_hooks = {
-       .name = "r600",
-       .driver_name = "r600",
-       .create_screen = r600_drm_create_screen,
-       .destroy = r600_drm_api_destroy,
- };
- struct drm_api* drm_api_create()
- {
- #ifdef DEBUG
-       return trace_drm_create(&drm_api_hooks);
- #else
-       return &drm_api_hooks;
- #endif
- }